All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / OPP: silence an uninitialized variable warning
@ 2018-05-16  8:49 Dan Carpenter
  2018-05-16  9:44 ` Viresh Kumar
  2018-05-16  9:51 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-05-16  8:49 UTC (permalink / raw)
  To: kernel-janitors

Smatch complains that "rate" can be uninitialized here.

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

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 7026e9f484ea..afc844806db0 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -317,7 +317,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev,
 
 	/* Check if the OPP supports hardware's hierarchy of versions or not */
 	if (!_opp_is_supported(dev, opp_table, np)) {
-		dev_dbg(dev, "OPP not supported by hardware: %llu\n", rate);
+		dev_dbg(dev, "OPP not supported by hardware: %lu\n",
+			new_opp->rate);
 		goto free_opp;
 	}
 

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

* Re: [PATCH] PM / OPP: silence an uninitialized variable warning
  2018-05-16  8:49 [PATCH] PM / OPP: silence an uninitialized variable warning Dan Carpenter
@ 2018-05-16  9:44 ` Viresh Kumar
  2018-05-16  9:51 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2018-05-16  9:44 UTC (permalink / raw)
  To: kernel-janitors

On 16-05-18, 11:49, Dan Carpenter wrote:
> Smatch complains that "rate" can be uninitialized here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index 7026e9f484ea..afc844806db0 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -317,7 +317,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev,
>  
>  	/* Check if the OPP supports hardware's hierarchy of versions or not */
>  	if (!_opp_is_supported(dev, opp_table, np)) {
> -		dev_dbg(dev, "OPP not supported by hardware: %llu\n", rate);
> +		dev_dbg(dev, "OPP not supported by hardware: %lu\n",
> +			new_opp->rate);
>  		goto free_opp;
>  	}

Well, I never got that warning nor did the buildbot report me anything
like that. Not sure how you got that :)

But AFAICT, there is indeed a path where this can happen and I am not
sure the proposed solution is the most readable one. I would rather
initialize rate to 0 while defining it at the top.

-- 
viresh

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

* Re: [PATCH] PM / OPP: silence an uninitialized variable warning
  2018-05-16  8:49 [PATCH] PM / OPP: silence an uninitialized variable warning Dan Carpenter
  2018-05-16  9:44 ` Viresh Kumar
@ 2018-05-16  9:51 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-05-16  9:51 UTC (permalink / raw)
  To: kernel-janitors

On Wed, May 16, 2018 at 03:02:33PM +0530, Viresh Kumar wrote:
> On 16-05-18, 11:49, Dan Carpenter wrote:
> > Smatch complains that "rate" can be uninitialized here.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> > index 7026e9f484ea..afc844806db0 100644
> > --- a/drivers/opp/of.c
> > +++ b/drivers/opp/of.c
> > @@ -317,7 +317,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev,
> >  
> >  	/* Check if the OPP supports hardware's hierarchy of versions or not */
> >  	if (!_opp_is_supported(dev, opp_table, np)) {
> > -		dev_dbg(dev, "OPP not supported by hardware: %llu\n", rate);
> > +		dev_dbg(dev, "OPP not supported by hardware: %lu\n",
> > +			new_opp->rate);
> >  		goto free_opp;
> >  	}
> 
> Well, I never got that warning nor did the buildbot report me anything
> like that. Not sure how you got that :)
> 
> But AFAICT, there is indeed a path where this can happen and I am not
> sure the proposed solution is the most readable one. I would rather
> initialize rate to 0 while defining it at the top.
> 

Sure.  No problem.  I'll resend.

regards,
dan carpenter


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

end of thread, other threads:[~2018-05-16  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16  8:49 [PATCH] PM / OPP: silence an uninitialized variable warning Dan Carpenter
2018-05-16  9:44 ` Viresh Kumar
2018-05-16  9:51 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.