diff mbox

PM / OPP: passing NULL to PTR_ERR()

Message ID 20150921162602.GE5648@mwanda (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Dan Carpenter Sept. 21, 2015, 4:26 p.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Viresh Kumar Sept. 21, 2015, 6:59 p.m. UTC | #1
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>
Rafael J. Wysocki Sept. 25, 2015, 9:55 p.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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