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; }