cpufreq: scpi: fix static checker warning cdev isn't an ERR_PTR

Message ID 1516632067-9584-1-git-send-email-sudeep.holla@arm.com
State New
Headers show
Series
  • cpufreq: scpi: fix static checker warning cdev isn't an ERR_PTR
Related show

Commit Message

Sudeep Holla Jan. 22, 2018, 2:41 p.m.
Commit 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")
leads to the following static checker warning:

	drivers/cpufreq/scpi-cpufreq.c:203 scpi_cpufreq_ready()
	warn: 'cdev' isn't an ERR_PTR

of_cpufreq_cooling_register() returns NULL on error. This patch removes
the incorrect IS_ERR check on the returned pointer.

Fixes: 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

---
 drivers/cpufreq/scpi-cpufreq.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
2.7.4

Comments

Viresh Kumar Jan. 23, 2018, 2:41 a.m. | #1
On 22-01-18, 14:41, Sudeep Holla wrote:
> Commit 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")

> leads to the following static checker warning:

> 

> 	drivers/cpufreq/scpi-cpufreq.c:203 scpi_cpufreq_ready()

> 	warn: 'cdev' isn't an ERR_PTR

> 

> of_cpufreq_cooling_register() returns NULL on error. This patch removes

> the incorrect IS_ERR check on the returned pointer.

> 

> Fixes: 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

> Cc: Viresh Kumar <viresh.kumar@linaro.org>

> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> ---

>  drivers/cpufreq/scpi-cpufreq.c | 5 +----

>  1 file changed, 1 insertion(+), 4 deletions(-)


Acked-by: Viresh Kumar <viresh.kumar@linaro.org>


-- 
viresh
Rafael J. Wysocki Feb. 8, 2018, 10:06 a.m. | #2
On Tuesday, January 23, 2018 3:41:42 AM CET Viresh Kumar wrote:
> On 22-01-18, 14:41, Sudeep Holla wrote:

> > Commit 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")

> > leads to the following static checker warning:

> > 

> > 	drivers/cpufreq/scpi-cpufreq.c:203 scpi_cpufreq_ready()

> > 	warn: 'cdev' isn't an ERR_PTR

> > 

> > of_cpufreq_cooling_register() returns NULL on error. This patch removes

> > the incorrect IS_ERR check on the returned pointer.

> > 

> > Fixes: 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")

> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

> > Cc: Viresh Kumar <viresh.kumar@linaro.org>

> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> > ---

> >  drivers/cpufreq/scpi-cpufreq.c | 5 +----

> >  1 file changed, 1 insertion(+), 4 deletions(-)

> 

> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>


Patch applied, thanks!

Patch

diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
index 247fcbfa4cb5..efe32cbefa06 100644
--- a/drivers/cpufreq/scpi-cpufreq.c
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -197,11 +197,8 @@  static int scpi_cpufreq_exit(struct cpufreq_policy *policy)
 static void scpi_cpufreq_ready(struct cpufreq_policy *policy)
 {
 	struct scpi_data *priv = policy->driver_data;
-	struct thermal_cooling_device *cdev;
 
-	cdev = of_cpufreq_cooling_register(policy);
-	if (!IS_ERR(cdev))
-		priv->cdev = cdev;
+	priv->cdev = of_cpufreq_cooling_register(policy);
 }
 
 static struct cpufreq_driver scpi_cpufreq_driver = {