lkml.org 
[lkml]   [2019]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
Thanks Mark, I will send a new patch and check the return value instead.

On Tue, Sep 3, 2019 at 4:26 AM Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Sep 02, 2019 at 03:10:47PM -0700, Yizhuo wrote:
> > In function pfuze100_regulator_probe(), variable "val" could be
> > initialized if regmap_read() fails. However, "val" is used to
> > decide the control flow later in the if statement, which is
> > potentially unsafe.
>
> > struct regulator_desc *desc;
> > - int val;
> > + int val = 0;
>
> This just unconditionally assings a value to this variable which will
> stop any warnings but there's no analysis explaining why this is a good
> fix - are we actually forgetting to check something we should be
> checking, are we sure that this is the correct value to use?



--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

\
 
 \ /
  Last update: 2019-09-03 18:21    [W:0.070 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site