linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] CPUFREQ: Loongson1: Fix return value check in ls1x_cpufreq_probe()
@ 2016-07-06 12:20 weiyj_lk
  2016-07-06 14:14 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: weiyj_lk @ 2016-07-06 12:20 UTC (permalink / raw)
  To: Keguang Zhang, Rafael J. Wysocki, Viresh Kumar
  Cc: Wei Yongjun, linux-mips, linux-pm

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function clk_get_parent() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/cpufreq/loongson1-cpufreq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/loongson1-cpufreq.c b/drivers/cpufreq/loongson1-cpufreq.c
index be89416..b3a62d0 100644
--- a/drivers/cpufreq/loongson1-cpufreq.c
+++ b/drivers/cpufreq/loongson1-cpufreq.c
@@ -162,18 +162,18 @@ static int ls1x_cpufreq_probe(struct platform_device *pdev)
 	cpufreq->clk = clk;
 
 	clk = clk_get_parent(clk);
-	if (IS_ERR(clk)) {
+	if (!clk) {
 		dev_err(&pdev->dev, "unable to get parent of %s clock\n",
 			__clk_get_name(cpufreq->clk));
-		return PTR_ERR(clk);
+		return -ENODEV;
 	}
 	cpufreq->mux_clk = clk;
 
 	clk = clk_get_parent(clk);
-	if (IS_ERR(clk)) {
+	if (!clk) {
 		dev_err(&pdev->dev, "unable to get parent of %s clock\n",
 			__clk_get_name(cpufreq->mux_clk));
-		return PTR_ERR(clk);
+		return -ENODEV;
 	}
 	cpufreq->pll_clk = clk;



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] CPUFREQ: Loongson1: Fix return value check in ls1x_cpufreq_probe()
  2016-07-06 12:20 [PATCH -next] CPUFREQ: Loongson1: Fix return value check in ls1x_cpufreq_probe() weiyj_lk
@ 2016-07-06 14:14 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2016-07-06 14:14 UTC (permalink / raw)
  To: weiyj_lk
  Cc: Keguang Zhang, Rafael J. Wysocki, Wei Yongjun, linux-mips,
	linux-pm

On 06-07-16, 12:20, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function clk_get_parent() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.

NULL is a valid clock as per the clk-API and so this patch is wrong.

You need to investigate why you are getting NULL here for your
platform.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-06 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-06 12:20 [PATCH -next] CPUFREQ: Loongson1: Fix return value check in ls1x_cpufreq_probe() weiyj_lk
2016-07-06 14:14 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).