Message ID | 30b17e2219abc3a9a137d28bb51e53732bba5103.1682428267.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3397029vqo; Tue, 25 Apr 2023 06:16:17 -0700 (PDT) X-Google-Smtp-Source: AKy350aJhHC1i2ciU8551IRRfCiCqh9N/cwDhOY3b4OH8+dWzsaaroaBTjyVLQzSp6L6S99/eIHl X-Received: by 2002:a05:6a20:6a23:b0:f0:86ce:d02c with SMTP id p35-20020a056a206a2300b000f086ced02cmr20753350pzk.16.1682428577387; Tue, 25 Apr 2023 06:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682428577; cv=none; d=google.com; s=arc-20160816; b=CbZU1yu11kEut2Q2x3PSVChjBcnzDTAR03jgB4GBQrx/dDY7yTv5M0FFPyTpvHYgFd 3B9p5/Ba6owTWajj0cScwR/Jv9IRSaOMjvunztUHH4WA3isdiw+CwSv0G2x5YYAkAQVR SlaBTUWJZR6lRfduM4C7gtfovdvM+QA5pWsxO02k5d4o/sPBEWg7kQalSCHTWP60zIjf ciyQ9O9OwdTcEzikDf91o8Cj/tjSPbtey3320XPxUDY3ehkbrH+9zsnlXJlGOURQbhFj SVmBG+sfiQlf3EP+Nr4MT53gSzqiT0Qf2TPXU8l3XxMQb4oHHSu2i/1bYh/JwgoH50V3 4FyA== 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:dkim-signature; bh=WXiKOTUweT4dQBcURtN4IPuxsbpAL9eY85lFUMFtYlY=; b=EUpFDLJkRMSyQbMf3b/9d0tr6Ong1nFeT+eiCSXnehzH++OymcsxznI8y2ySV9rjFf 7M2IRyZW8thDOPy6xpgSX4LKRE/xO0W0c50B04TSDZMT9Q/agGyFk+hawGjxBW3IK1Ld d8IwySSOn8YcvAJZWw9EGrWkbxgzwAxFA4DFNx1uNonIlCd6vsM3Nqpxr96t4gD8x7yd dNPpQf2dnqWWyRsoW7ZFdxIhwO1hfjBjbgO9lD8uFtHziYaBeNMfP7zyb84G8ZciGfOD gz+TsgeDKUu4jBxh6MsFhoKx3zhD2kyLmlLemGM/d49kK+t+tRSblJHvx9nt4D+BT8qB 3n5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=hbpLJFvC; 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 t11-20020a63460b000000b0051b28ed8df2si13683594pga.571.2023.04.25.06.16.01; Tue, 25 Apr 2023 06:16:17 -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=@wanadoo.fr header.s=t20230301 header.b=hbpLJFvC; 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 S234036AbjDYNL1 (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Tue, 25 Apr 2023 09:11:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233082AbjDYNL0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Apr 2023 09:11:26 -0400 Received: from smtp.smtpout.orange.fr (smtp-11.smtpout.orange.fr [80.12.242.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA7CA249 for <linux-kernel@vger.kernel.org>; Tue, 25 Apr 2023 06:11:24 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id rIS0pfcRMLf5zrIS0p4TSz; Tue, 25 Apr 2023 15:11:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682428281; bh=WXiKOTUweT4dQBcURtN4IPuxsbpAL9eY85lFUMFtYlY=; h=From:To:Cc:Subject:Date; b=hbpLJFvCsemS0Uu45T4qTVqdi6a3ZqQQ+8kgeY1JgGuAqYlNDAdj6kEkBbXH2Sn1E CbPD7bQGrDkA8WZ8qXAHkNi5BxTR9wy167CR12PDQlv/IZICEwocqLw2dhHjwiYFBL wphRORSM/lG3G8wQ9Vn23Zxi8AOvB84be+HoU/Q2xfwZiBRmpsKiYMb3FMkFyrNp5I 2QzSqucKwZgi+TWyd5J6f0cITlGWj5pCuOFgy3LWA98ADXpBw+xWoQtQwLpuiRdZQv o6xowQaW5SnjZJby0ENTYyye77DpXRGCR9VgZlvVVOnxNpJmrJWZiCO/sZkLCNhl+b C2lrLVzZ0Au+Q== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 25 Apr 2023 15:11:21 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: "Rafael J. Wysocki" <rafael@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>, Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>, Sumit Gupta <sumitg@nvidia.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH] cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe() Date: Tue, 25 Apr 2023 15:11:19 +0200 Message-Id: <30b17e2219abc3a9a137d28bb51e53732bba5103.1682428267.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764154228070130354?= X-GMAIL-MSGID: =?utf-8?q?1764154228070130354?= |
Series |
cpufreq: tegra194: Fix an error handling path in tegra194_cpufreq_probe()
|
|
Commit Message
Christophe JAILLET
April 25, 2023, 1:11 p.m. UTC
If the probe needs to be deferred, some resources still need to be
released. So branch to the error handling path instead of returning
directly.
Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
---
drivers/cpufreq/tegra194-cpufreq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
On 25/04/23 18:41, Christophe JAILLET wrote: > External email: Use caution opening links or attachments > > > If the probe needs to be deferred, some resources still need to be > released. So branch to the error handling path instead of returning > directly. > > Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Sumit Gupta <sumitg@nvidia.com> > --- > Compile tested-only > --- > drivers/cpufreq/tegra194-cpufreq.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c > index c8d03346068a..36dad5ea5947 100644 > --- a/drivers/cpufreq/tegra194-cpufreq.c > +++ b/drivers/cpufreq/tegra194-cpufreq.c > @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) > > /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */ > cpu_dev = get_cpu_device(0); > - if (!cpu_dev) > - return -EPROBE_DEFER; > + if (!cpu_dev) { > + err = -EPROBE_DEFER; > + goto err_free_res; > + } > > if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) { > err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL); > -- > 2.34.1 >
On Tue, Apr 25, 2023 at 03:11:19PM +0200, Christophe JAILLET wrote: > If the probe needs to be deferred, some resources still need to be > released. So branch to the error handling path instead of returning > directly. > > Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > Compile tested-only > --- > drivers/cpufreq/tegra194-cpufreq.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c > index c8d03346068a..36dad5ea5947 100644 > --- a/drivers/cpufreq/tegra194-cpufreq.c > +++ b/drivers/cpufreq/tegra194-cpufreq.c > @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) > > /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */ > cpu_dev = get_cpu_device(0); > - if (!cpu_dev) > - return -EPROBE_DEFER; > + if (!cpu_dev) { > + err = -EPROBE_DEFER; > + goto err_free_res; > + } I think ultimately it'd be better to try get_cpu_device(0) earlier so that we don't do all that work upfront before we fail. However, it looks like there's some other improvements that could be done in that area, so this looks like a good fix in the meantime: Acked-by: Thierry Reding <treding@nvidia.com>
On 25-04-23, 15:11, Christophe JAILLET wrote: > If the probe needs to be deferred, some resources still need to be > released. So branch to the error handling path instead of returning > directly. > > Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > Compile tested-only > --- > drivers/cpufreq/tegra194-cpufreq.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c > index c8d03346068a..36dad5ea5947 100644 > --- a/drivers/cpufreq/tegra194-cpufreq.c > +++ b/drivers/cpufreq/tegra194-cpufreq.c > @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) > > /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */ > cpu_dev = get_cpu_device(0); > - if (!cpu_dev) > - return -EPROBE_DEFER; > + if (!cpu_dev) { > + err = -EPROBE_DEFER; > + goto err_free_res; > + } > > if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) { > err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL); Applied. Thanks.
diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c index c8d03346068a..36dad5ea5947 100644 --- a/drivers/cpufreq/tegra194-cpufreq.c +++ b/drivers/cpufreq/tegra194-cpufreq.c @@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */ cpu_dev = get_cpu_device(0); - if (!cpu_dev) - return -EPROBE_DEFER; + if (!cpu_dev) { + err = -EPROBE_DEFER; + goto err_free_res; + } if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) { err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);