From patchwork Thu Jun 15 12:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 108490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp607400vqr; Thu, 15 Jun 2023 05:48:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VGYGGnjRo+oJUbHIDIfv63UCmoR2w/tMGAWNvibagaKq5XPzrnc2cheTo+mJGHBIFk2Hp X-Received: by 2002:a05:6a20:728d:b0:11d:9716:9622 with SMTP id o13-20020a056a20728d00b0011d97169622mr5203580pzk.39.1686833302974; Thu, 15 Jun 2023 05:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686833302; cv=none; d=google.com; s=arc-20160816; b=y0UkK0GpDsXuoJpKVclu3F59Ujt50urJnUsAAY57Iz3YihSNJnvJ0g7mZZuwc3+wTr 2S+c/Njgge4R+Afm/uN9jDZKSBWHV6B6yZTrLE+QG2m5u3j4oxsrphxdXAZShCRDydpV yCHMo+HseLzuYjZd5nAB00dwQgyrbNtfkdI+UcVWGAWkrVPK06p4o4gChxhjTGXYwokN cq27sn3Dk4QzBEaQXR8Z5dJXEm8dNRqlF7ijydj5Cduv8O+U9CtEU7YSXWskJLEdNRZC n/Wx++ZCCwZLZKatC0c6sNkodVhCKKSKBN7FSOrQaSLwu6UPDS4Xp4twyD0/M7s0n2cD XRKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z8VNU9JW1ek4p8ffKMo+GUxhnVhGUz4e/cllw3RiFik=; b=MTj9V7bQYA8FZFOnZOToT9tI5FD4XvC9QdAAarPDhv/6BdLe2/g2d3C67h3g0k1wmg e9mWPUUPDxJ9m3kzuyhLKADmNPDjxxdfRrcUWgcIDzvKZSCVfwSuj1nZZ39rAkCEZJ/d l3c1HFBYo8H/CBjGD51KmPx/K/GFZN0sV6PY9390uTPh+muFUOFrSbJhv0MpwbdwbVAn uekGN7VyjoGNCfemWb11rfP8s7Xy+cgTj1UTt5ep2zzut7qJoN5gGzBKYeil9FWOPHKT p0F6SBRg5tZAJvVUwnJLnUjhPy8l5cTvElNxD9auQnwhUk3zfdp7aPNNJZMZL0n5tRYm uA+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NCUM0nDM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902dacd00b001b3d7fbb4cbsi6987469plx.71.2023.06.15.05.48.09; Thu, 15 Jun 2023 05:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NCUM0nDM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344521AbjFOMWs (ORCPT + 99 others); Thu, 15 Jun 2023 08:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343863AbjFOMWG (ORCPT ); Thu, 15 Jun 2023 08:22:06 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8602296A; Thu, 15 Jun 2023 05:21:08 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:c5f8:7372:f042:90a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 84B476606F67; Thu, 15 Jun 2023 13:21:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686831667; bh=4aiyV1F8YWPE0QD7T7sc+5l0IdShBNTT+itlcGPT43I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NCUM0nDMs5IMGeF+0E/wTawLh3jskwUw8sCRy1RThhXvkSDJPKuIZTifDIaCAnOgp Q9wwEIgF53IKfBI1fddxs9UfYV/G/+bAMaDVW6W5MfGbfyxNSYQhmuiZ0sbUNlAVvi /s2jwO87uDepvGqpsINWuiqzvgEvn501qhnMwrCyztORDlcwphRxJ/THWq2/69p0lP TJi5VOzl9jBj7RZl7kkPz8CvmScFIMFK8YuzQ4G8DHLofXOB/h74xfmmMG9GNsjtvi HEA8FQmgvbSbpAOeXYuE58DYnQ4sqMrIzTO7dY7a5Ymavzqfnb3rmKh1pgYZmSAmaF ohfZZdU4aIdug== From: AngeloGioacchino Del Regno To: sboyd@kernel.org Cc: mturquette@baylibre.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, u.kleine-koenig@pengutronix.de, msp@baylibre.com, miles.chen@mediatek.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com Subject: [PATCH 1/3] clk: mediatek: clk-mtk: Grab iomem pointer for divider clocks Date: Thu, 15 Jun 2023 14:20:49 +0200 Message-Id: <20230615122051.546985-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615122051.546985-1-angelogioacchino.delregno@collabora.com> References: <20230615122051.546985-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768772917329592784?= X-GMAIL-MSGID: =?utf-8?q?1768772917329592784?= In the rare case in which one of the clock drivers has divider clocks but not composite clocks, mtk_clk_simple_probe() would not io(re)map, hence passing a NULL pointer to mtk_clk_register_dividers(). To fix this issue, extend the `if` conditional to also check if any divider clocks are present. While at it, also make sure the iomem pointer is NULL if no composite/divider clocks are declared, as we are checking for that when iounmapping it in the error path. This hasn't been seen on any MediaTek clock driver as the current ones always declare composite clocks along with divider clocks, but this is still an important fix for a future potential KP. Fixes: 1fe074b1f112 ("clk: mediatek: Add divider clocks to mtk_clk_simple_{probe,remove}()") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai Reviewed-by: Markus Schneider-Pargmann --- drivers/clk/mediatek/clk-mtk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index cf3514c8e97e..b00ef4213335 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -469,7 +469,7 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, const struct platform_device_id *id; const struct mtk_clk_desc *mcd; struct clk_hw_onecell_data *clk_data; - void __iomem *base; + void __iomem *base = NULL; int num_clks, r; mcd = device_get_match_data(&pdev->dev); @@ -483,8 +483,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, return -EINVAL; } - /* Composite clocks needs us to pass iomem pointer */ - if (mcd->composite_clks) { + /* Composite and divider clocks needs us to pass iomem pointer */ + if (mcd->composite_clks || mcd->divider_clks) { if (!mcd->shared_io) base = devm_platform_ioremap_resource(pdev, 0); else From patchwork Thu Jun 15 12:20:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 108494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp609618vqr; Thu, 15 Jun 2023 05:52:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7lAaOhIVgCo/lbQFXoMuMgQYV4GmFq0YHYVDSuuDFjNLtR70EBDxrVwzSygSZOxDlWFhfS X-Received: by 2002:a05:6a20:7d82:b0:110:f65a:13fb with SMTP id v2-20020a056a207d8200b00110f65a13fbmr5177603pzj.15.1686833556246; Thu, 15 Jun 2023 05:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686833556; cv=none; d=google.com; s=arc-20160816; b=zBAYQcEYEX+QIxFYWKedcEOk+jylYHyKDsCPbiAV32t7gWK/3OhlVObxqGBBbTIuw+ 14WDkZJ/jyYpaOIsMwACgzNhNp7PDFpm3/pZP1oH6VzvvtA4R0l+cZ4+RexHn3s8OAzL xJpoRBVlHur8YTBtIlPFnI3/WYCPMI/iIX/TlWgq34Vx9Nv8cIObjzktyCpsgoBwOrQc RsMLOyyfUIYZYq8mbwGeKGFa8/OPWWTf+wVKpyOjJYu6CuDQMIpAPDOOAY6ZyHTQF2Di TFT3kKy4nSmh47WbYTi9/d6bp7BsV07jfR8KtbmxVjv1LjZjy55hLSdPhK7s5V9p1riY 08tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EgljuJ86yP5II0bE2xSGbo0u0e2ju485aUaxj5I97qs=; b=YZSeaKkDlyo9FuA8rFE/RZaA5VfdTnqSL+GcUZcaFb8tg2euphulzeSetx2IaKMz26 +wX+5Pz4WoB8wF+HV5autV14mzHz3zrm/YjTv5oHLYI++b1tvLRmik/+2SSwcKOLIzLq qGtuC0ujVuYVspQnbnYtodH9bE7T70EW8s7Me7T+Qy7uA9XqhjGhLindlc9gAfswsLay BHT6VGGDQVFgiH6ORmyDuw78ssNA0hvu5n44wQa0ViOozIJv+VAqKECfCMzbtupGyp/g nNmwW+WKG9c6PQCKhQHQ4C2EK53Dya7kOI6Vx8MC4ce0lhmDNgpccel+SoxXLn1B0mSE USDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KEtD9Oqs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q23-20020a638c57000000b0053eef685a0csi1595806pgn.852.2023.06.15.05.52.21; Thu, 15 Jun 2023 05:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KEtD9Oqs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240415AbjFOMWy (ORCPT + 99 others); Thu, 15 Jun 2023 08:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344402AbjFOMWH (ORCPT ); Thu, 15 Jun 2023 08:22:07 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A42C2976; Thu, 15 Jun 2023 05:21:09 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:c5f8:7372:f042:90a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 76D1A6606F6A; Thu, 15 Jun 2023 13:21:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686831668; bh=hSYDHRQZFg61OZRhqwBnz/BlpiaeFapUIjvjpav/ea8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEtD9OqsW7lISwZrho68MiM8bf3s3nGT8DNIEW7ilAGpkszs1uR6kHuY4lbMxwkHx vv3Axz4B7shUPazZfsjXfyfPlowcg66gDiGAGS6rrDdLzwhCD4gtjgETdUzsYLPCSt C/yMzpi1f/FYTOjIfuukG5gUGNpZ/nfaULMRl1f+uJbIbp9ED5TT/pxHiO4Drac+f/ 4LgcTtGsqLMMkVL33z/6E6rdYyvNB2iEZxuv80YJs/GG1w241ZLyjgZef/XJ4crUdR ZV71jwlP/B8BDkNgjggdkazg0w2b+ms/vGe8MqrgwtH6HeXVGy/ejDw8T5HoMqd6tf CZsmvjoSESgsA== From: AngeloGioacchino Del Regno To: sboyd@kernel.org Cc: mturquette@baylibre.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, u.kleine-koenig@pengutronix.de, msp@baylibre.com, miles.chen@mediatek.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com Subject: [PATCH 2/3] clk: mediatek: clk-mt8173-apmixedsys: Fix return value for of_iomap() error Date: Thu, 15 Jun 2023 14:20:50 +0200 Message-Id: <20230615122051.546985-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615122051.546985-1-angelogioacchino.delregno@collabora.com> References: <20230615122051.546985-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768773183256100366?= X-GMAIL-MSGID: =?utf-8?q?1768773183256100366?= The of_iomap() function returns NULL in case of error so usage of PTR_ERR() is wrong! Change that to return -ENOMEM in case of failure. Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai Reviewed-by: Markus Schneider-Pargmann --- drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c index daa2856d1ab7..ba1386e70a24 100644 --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c @@ -148,7 +148,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) base = of_iomap(node, 0); if (!base) - return PTR_ERR(base); + return -ENOMEM; clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); if (IS_ERR_OR_NULL(clk_data)) From patchwork Thu Jun 15 12:20:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 108497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp610625vqr; Thu, 15 Jun 2023 05:54:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ovp5Q0jZFJuDvoraq1toPpVPkCg2rJ54PoebWX9SzFkmceZ4nCYBjj5fhK3CVOaQC/Ykr X-Received: by 2002:a2e:b0c3:0:b0:2b1:b9b9:20d4 with SMTP id g3-20020a2eb0c3000000b002b1b9b920d4mr7956866ljl.5.1686833667344; Thu, 15 Jun 2023 05:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686833667; cv=none; d=google.com; s=arc-20160816; b=KIGgaem0rMAXf3Jvw4W/4bMucTddVNhxkT9YoryEOcUNd4qnSnz1i5yHqEymiV69LX MBn3cl1QwA/eYlYFYmYFxl/yz7IvPM9cTlXUdF4+6Bh0Ew26FYjvS8H1W5NbNX1w4LZS pPNIPiWqKr3Te2bW2n1XpTzR9XmeQ9VBTLd6gr+oNY4z95+6Q97FBTzGWFKnJLB0Zfi2 7XSCZ58TWV0F906Jn/yNdx5ndCOdlHTeTHWExroUO9Gdy9qPI2mT9yP66YGeMu6wSp3J sU11g4PvD87F1MQJ8i+jNqIH37nzNOeJerliUhfosCRbrVgal0oj6JKjdHMFJFbRY/DQ 5TZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CPOV/siwNYabRVqnQGFNnDT0X3Og+j/1JoZMfa2hxqQ=; b=KcVFFnMvsVcYxuxJPncbh2BPTVukpefhf2VABP8JdgPeZ/utn2olMNsGLq32P6hI5n Ou+yB80fNl41YT20YcUc5auNPvIkOeQyOrQKImPsTs1ijNjcxDWiIfCWdT7cRZ9hj6TN xraQz2m2MPc4R9mOUT/LrI4B/uJxTaW1hZ1upDbwtsMg2NLWVfgYbkKDWBzGCkFZAulz +AOW6zNRb0Pyou6mm3XWUhKM1AjOJFqLO7D0iKRnrqk99LxGMOHNrRay+gY4e+nKHyUV vRoNznr15754V1vS0DZ8WHF6FSCsvM+Myhlmu0s9k3onY79LkQIrqGlNXrfZBUz6Ooj+ Wf7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YMuyc0yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020aa7cb92000000b0051a1e3d787csi1398120edt.198.2023.06.15.05.54.03; Thu, 15 Jun 2023 05:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YMuyc0yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344829AbjFOMW5 (ORCPT + 99 others); Thu, 15 Jun 2023 08:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344404AbjFOMWI (ORCPT ); Thu, 15 Jun 2023 08:22:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD36297C; Thu, 15 Jun 2023 05:21:10 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:c5f8:7372:f042:90a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 66FB36606F6E; Thu, 15 Jun 2023 13:21:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686831669; bh=vpOgvT6yygDmgfAiQqASqbcSsnVHPhA2AtXGuQCWxfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMuyc0yb8fxIW6zoWi+1oHJMnciKLwwSzP+XQXbUMZ85AwWoloC8MY5PiQLE2GWtn xS9zWDy4wuxIIGsgz8aMVjziOj/2nyHoe3TscpJrakY0t+o74owZNgw/OnwsojCb+y XoYI+6tCzyTaSCiIR/zcegZMGNBt3ohBvgXet5qRPFGjF96Glh4MEPPdAOdq0ulUyA urK5G5Mo3BEoZEC3myqd96yH0J3NYVAOZu7tvUO7bDh+a+g2Vz9u76t0pgWzBgbKPq nMq0qC1n3OioHZY4qaFlIKmuHZ28t/4+2FOsXAQs3DPiWMLHjf7XnUXXgoEQQmlqpl /iWSFZNhRdN4A== From: AngeloGioacchino Del Regno To: sboyd@kernel.org Cc: mturquette@baylibre.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, u.kleine-koenig@pengutronix.de, msp@baylibre.com, miles.chen@mediatek.com, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com Subject: [PATCH 3/3] clk: mediatek: clk-mt8173-apmixedsys: Fix iomap not released issue Date: Thu, 15 Jun 2023 14:20:51 +0200 Message-Id: <20230615122051.546985-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615122051.546985-1-angelogioacchino.delregno@collabora.com> References: <20230615122051.546985-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768773299289794023?= X-GMAIL-MSGID: =?utf-8?q?1768773299289794023?= In case of error after of_ioremap() the resource must be released: call iounmap() where appropriate to fix that. Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c index ba1386e70a24..1bbb21ab1786 100644 --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c @@ -151,8 +151,10 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) return -ENOMEM; clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); - if (IS_ERR_OR_NULL(clk_data)) + if (IS_ERR_OR_NULL(clk_data)) { + iounmap(base); return -ENOMEM; + } fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs)); r = mtk_clk_register_pllfhs(node, plls, ARRAY_SIZE(plls), @@ -186,6 +188,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) ARRAY_SIZE(pllfhs), clk_data); free_clk_data: mtk_free_clk_data(clk_data); + iounmap(base); return r; }