From patchwork Sun Nov 20 13:01:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 23412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1108689wrr; Sun, 20 Nov 2022 05:12:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf6QHcdW3f2Mk60LLmJmD5DKph7sNmnEw/kx1Yufx+FjUwrQOZ6rcxzQF9XA+rLvpptxEZ8+ X-Received: by 2002:a63:4a25:0:b0:46e:bcc0:c735 with SMTP id x37-20020a634a25000000b0046ebcc0c735mr13633961pga.483.1668949944593; Sun, 20 Nov 2022 05:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668949944; cv=none; d=google.com; s=arc-20160816; b=BkcRewRgvmu5/7r1BYmm8AoqlrsnboyzbV9q/70QRus8dIm2jVXIZ1xTs7QATRiuLM QbnzUJCEuOh7ozEo2bivodg7Lh/rd3Qr8M7J5eY6oN15PZFG96sXsBXWd6QQQ+xTW9fB TefUfF9E+YavG/1Kyr0OuG6e81jkGTC07U/IUob7pQti+3t9/QE097t/kUrZaUpzicNl nuydv86pPstNgPJ1cLNCFvJ9xEUELEIModAqUUjv3OCnt62OUon9HL4TUAcfElNDgOzL j/a/loFQ4lYP3JeNYhPmih4aizl4n7U4vyyn67CJ5e2rEeM2qrqQWQ+OvXFMOWAkQ+vo oIwg== 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 :message-id:date:subject:cc:to:from; bh=3Z9d8HE2KlJR9LWxzLm1U5Efc/f7YdLXmLmQHROvkOo=; b=a131D4PTmkmZOxhhDreche+v3p/r0lhqV0HmW1s62vS63nVasKRqUVgA9Fbp12HZsx TXohgwonZbHGu7fmMqWno7wKJGIWWJYRWryXZWvMSdO8Nlzkgvke/KJ5sLTpLuKr43Fl ZsrfIxFDXo+zUXuIE2LXOQX0QJmgBB3vjbbDp0yIjhzOHTBOaF7kP7CdCkHjKuhv1C2Q cD+mp6zGTzX4SWXFa2uwaGFbdXYgcjwFZrGcvdWKf19QtGHedTKbnyp9oPYpngjtg9yp EELIRVoe3LunvjW6EB0hqhlaa704ctD5llau3WvFNnKj6O8cJIe3CuQvCHTOgKQnrOHX 3cvA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a630114000000b0046f72960505si9391582pgb.393.2022.11.20.05.11.56; Sun, 20 Nov 2022 05:12:24 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbiKTNBx (ORCPT + 99 others); Sun, 20 Nov 2022 08:01:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbiKTNBs (ORCPT ); Sun, 20 Nov 2022 08:01:48 -0500 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA915205DF for ; Sun, 20 Nov 2022 05:01:47 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id wjxAo2gcMCoWhwjxAotLEg; Sun, 20 Nov 2022 14:01:46 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 20 Nov 2022 14:01:46 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Lee Jones , Linus Walleij Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Lee Jones , linux-arm-msm@vger.kernel.org Subject: [PATCH 1/2] mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe() Date: Sun, 20 Nov 2022 14:01:42 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS 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?1750020857121112768?= X-GMAIL-MSGID: =?utf-8?q?1750020857121112768?= If an error occurs after the clk_prepare_enable() call, a corresponding clk_disable_unprepare() should be called. Simplify code and switch to devm_clk_get_enabled() to fix it. Fixes: 3526403353c2 ("mfd: qcom_rpm: Handle message RAM clock") Signed-off-by: Christophe JAILLET --- This changes the order of the clean-ups if the .remove() function is called but it looks fine to me. --- drivers/mfd/qcom_rpm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c index 71bc34b74bc9..ea5eb94427c4 100644 --- a/drivers/mfd/qcom_rpm.c +++ b/drivers/mfd/qcom_rpm.c @@ -547,7 +547,7 @@ static int qcom_rpm_probe(struct platform_device *pdev) init_completion(&rpm->ack); /* Enable message RAM clock */ - rpm->ramclk = devm_clk_get(&pdev->dev, "ram"); + rpm->ramclk = devm_clk_get_enabled(&pdev->dev, "ram"); if (IS_ERR(rpm->ramclk)) { ret = PTR_ERR(rpm->ramclk); if (ret == -EPROBE_DEFER) @@ -558,7 +558,6 @@ static int qcom_rpm_probe(struct platform_device *pdev) */ rpm->ramclk = NULL; } - clk_prepare_enable(rpm->ramclk); /* Accepts NULL */ irq_ack = platform_get_irq_byname(pdev, "ack"); if (irq_ack < 0) @@ -681,7 +680,6 @@ static int qcom_rpm_remove(struct platform_device *pdev) struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev); of_platform_depopulate(&pdev->dev); - clk_disable_unprepare(rpm->ramclk); return 0; } From patchwork Sun Nov 20 13:01:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 23413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1113492wrr; Sun, 20 Nov 2022 05:26:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf5v3gR0K6BHZ1c8sRHDXHjUZ2mTbi3u1HinHUUEXeItI+Tk70YEE/jFzelmnE5t/BeTj2Sv X-Received: by 2002:aa7:d996:0:b0:469:8530:cbbe with SMTP id u22-20020aa7d996000000b004698530cbbemr1387621eds.134.1668950760942; Sun, 20 Nov 2022 05:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668950760; cv=none; d=google.com; s=arc-20160816; b=q2uixZRevidI3ZZGUZrFr8jpYvgD+j4u6N2VMnggWjzKFM2eiSOZcPQv+QH/c/SvyW j4HmCoMz4bSkTUzTRA3hXfSDaFadS6fBBA/pP1U4KEt7KtnigeQ7XANnaiATmXBuYuMF CG0XKFx85911kQ4hxOyHHL/BMdpRsBwKMDh33t+cfnR/+HiJbLDJcGhlLBThFGENnJ+S nJlMvpRXQ9nAEMWk2QKDV/6lcBmeHA2l7A/UkbLJf+T2NJp18rlreyf+5lzNFZCMbuK0 sD0LO9KFzptOD5vPPhJ1jsGUKgpH3xYmmciiFHuYy4Ld7FtEYWM1fKvQPSonpI2OnUC6 oBsw== 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; bh=0zP+tgRp14WAkF1K03JxH/MSmkVWw+vc/T8kVIxKmeI=; b=IykjBTIal7HKrZkP7AwUDAZrncJ6wptpOshh6xNTSCs8iAN2yJH4xYU8aB7aTz3i3J Fd7VPuGYkA0nPmMa7KKT1fv1uNfDBqKGKiS9meHfGCXeRchaUOp7trIPBOO81P3YAmaI 4OjHqASa0exOqATqVKnU3iw2ABAEi6Xz+P+hAwbiK/IQsVP8YzRxMGQlHvB4MRvvXUdk sYi9nt9M7TRAJPwseTua8Y2FfNngPatYDzHYqtb0EB2UPPg31Qur+s+18LEOd1i93W30 mVWht+fuJXBiAkm5J5VpvEgKC8y/V+zm9Qmw/lcQ+rJ8s3ckL4q8uMlVroL11tRxgvrU WVvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020aa7c1c5000000b0045dbfc32399si6977971edp.552.2022.11.20.05.25.32; Sun, 20 Nov 2022 05:26:00 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbiKTNBz (ORCPT + 99 others); Sun, 20 Nov 2022 08:01:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbiKTNBu (ORCPT ); Sun, 20 Nov 2022 08:01:50 -0500 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE8B20BF0 for ; Sun, 20 Nov 2022 05:01:49 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id wjxAo2gcMCoWhwjxDotLEw; Sun, 20 Nov 2022 14:01:48 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 20 Nov 2022 14:01:48 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Lee Jones Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-msm@vger.kernel.org Subject: [PATCH 2/2] mfd: qcom_rpm: Use devm_of_platform_populate() to simplify code Date: Sun, 20 Nov 2022 14:01:43 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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?1750021712983365825?= X-GMAIL-MSGID: =?utf-8?q?1750021712983365825?= Use devm_of_platform_populate() instead of hand-writing it. This simplifies the code. Signed-off-by: Christophe JAILLET --- This changes the order of the clean-ups if the .remove() function is called but it looks fine to me. --- drivers/mfd/qcom_rpm.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c index ea5eb94427c4..8fea0e511550 100644 --- a/drivers/mfd/qcom_rpm.c +++ b/drivers/mfd/qcom_rpm.c @@ -672,21 +672,11 @@ static int qcom_rpm_probe(struct platform_device *pdev) if (ret) dev_warn(&pdev->dev, "failed to mark wakeup irq as wakeup\n"); - return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); -} - -static int qcom_rpm_remove(struct platform_device *pdev) -{ - struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev); - - of_platform_depopulate(&pdev->dev); - - return 0; + return devm_of_platform_populate(&pdev->dev); } static struct platform_driver qcom_rpm_driver = { .probe = qcom_rpm_probe, - .remove = qcom_rpm_remove, .driver = { .name = "qcom_rpm", .of_match_table = qcom_rpm_of_match,