linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] PM / OPP: passing NULL to PTR_ERR()
@ 2015-09-21 16:26 Dan Carpenter
  2015-09-21 18:59 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-09-21 16:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Pavel Machek, Len Brown, Greg Kroah-Hartman, Stephen Boyd,
	Viresh Kumar, Bartlomiej Zolnierkiewicz, linux-pm,
	kernel-janitors

The code was using PTR_ERR(NULL) which causes a static checker warning.
I have fixed up the printks and changed the return to -ENOENT.

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

diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
index 3d946b5..7654c56 100644
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -223,8 +223,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask
 	/* Get OPP descriptor node */
 	np = _of_get_opp_desc_node(cpu_dev);
 	if (!np) {
-		dev_dbg(cpu_dev, "%s: Couldn't find opp node: %ld\n", __func__,
-			PTR_ERR(np));
+		dev_dbg(cpu_dev, "%s: Couldn't find cpu_dev node.\n", __func__);
 		return -ENOENT;
 	}
 
@@ -247,9 +246,9 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask
 		/* Get OPP descriptor node */
 		tmp_np = _of_get_opp_desc_node(tcpu_dev);
 		if (!tmp_np) {
-			dev_err(tcpu_dev, "%s: Couldn't find opp node: %ld\n",
-				__func__, PTR_ERR(tmp_np));
-			ret = PTR_ERR(tmp_np);
+			dev_err(tcpu_dev, "%s: Couldn't find tcpu_dev node.\n",
+				__func__);
+			ret = -ENOENT;
 			goto put_cpu_node;
 		}
 

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

* Re: [patch] PM / OPP: passing NULL to PTR_ERR()
  2015-09-21 16:26 [patch] PM / OPP: passing NULL to PTR_ERR() Dan Carpenter
@ 2015-09-21 18:59 ` Viresh Kumar
  2015-09-25 21:55   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2015-09-21 18:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Stephen Boyd, Bartlomiej Zolnierkiewicz, linux-pm,
	kernel-janitors

On 21-09-15, 19:26, Dan Carpenter wrote:
> The code was using PTR_ERR(NULL) which causes a static checker warning.
> I have fixed up the printks and changed the return to -ENOENT.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
> index 3d946b5..7654c56 100644
> --- a/drivers/base/power/opp/cpu.c
> +++ b/drivers/base/power/opp/cpu.c
> @@ -223,8 +223,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask
>  	/* Get OPP descriptor node */
>  	np = _of_get_opp_desc_node(cpu_dev);
>  	if (!np) {
> -		dev_dbg(cpu_dev, "%s: Couldn't find opp node: %ld\n", __func__,
> -			PTR_ERR(np));
> +		dev_dbg(cpu_dev, "%s: Couldn't find cpu_dev node.\n", __func__);
>  		return -ENOENT;
>  	}
>  
> @@ -247,9 +246,9 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask
>  		/* Get OPP descriptor node */
>  		tmp_np = _of_get_opp_desc_node(tcpu_dev);
>  		if (!tmp_np) {
> -			dev_err(tcpu_dev, "%s: Couldn't find opp node: %ld\n",
> -				__func__, PTR_ERR(tmp_np));
> -			ret = PTR_ERR(tmp_np);
> +			dev_err(tcpu_dev, "%s: Couldn't find tcpu_dev node.\n",
> +				__func__);
> +			ret = -ENOENT;
>  			goto put_cpu_node;
>  		}

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

-- 
viresh

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

* Re: [patch] PM / OPP: passing NULL to PTR_ERR()
  2015-09-21 18:59 ` Viresh Kumar
@ 2015-09-25 21:55   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2015-09-25 21:55 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Dan Carpenter, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Stephen Boyd, Bartlomiej Zolnierkiewicz, linux-pm,
	kernel-janitors

On Monday, September 21, 2015 11:59:39 AM Viresh Kumar wrote:
> On 21-09-15, 19:26, Dan Carpenter wrote:
> > The code was using PTR_ERR(NULL) which causes a static checker warning.
> > I have fixed up the printks and changed the return to -ENOENT.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
> > index 3d946b5..7654c56 100644
> > --- a/drivers/base/power/opp/cpu.c
> > +++ b/drivers/base/power/opp/cpu.c
> > @@ -223,8 +223,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask
> >  	/* Get OPP descriptor node */
> >  	np = _of_get_opp_desc_node(cpu_dev);
> >  	if (!np) {
> > -		dev_dbg(cpu_dev, "%s: Couldn't find opp node: %ld\n", __func__,
> > -			PTR_ERR(np));
> > +		dev_dbg(cpu_dev, "%s: Couldn't find cpu_dev node.\n", __func__);
> >  		return -ENOENT;
> >  	}
> >  
> > @@ -247,9 +246,9 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask
> >  		/* Get OPP descriptor node */
> >  		tmp_np = _of_get_opp_desc_node(tcpu_dev);
> >  		if (!tmp_np) {
> > -			dev_err(tcpu_dev, "%s: Couldn't find opp node: %ld\n",
> > -				__func__, PTR_ERR(tmp_np));
> > -			ret = PTR_ERR(tmp_np);
> > +			dev_err(tcpu_dev, "%s: Couldn't find tcpu_dev node.\n",
> > +				__func__);
> > +			ret = -ENOENT;
> >  			goto put_cpu_node;
> >  		}
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied, thanks!

Rafael


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

end of thread, other threads:[~2015-09-25 21:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 16:26 [patch] PM / OPP: passing NULL to PTR_ERR() Dan Carpenter
2015-09-21 18:59 ` Viresh Kumar
2015-09-25 21:55   ` Rafael J. Wysocki

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).