On Mon, Jan 20, 2020 at 09:09:17PM +0100, Uwe Kleine-König wrote: > Hello Thierry, > > On Mon, Jan 20, 2020 at 03:32:06PM +0100, Thierry Reding wrote: > > GCC can't always determine that the duty, period and prescaler values > > are initialized when returning from sun4i_pwm_calculate(), so help out a > > little by initializing them to 0. > > Is it worth mentioning the gcc version you're using? I could, but what good is that going to be? I don't think this is something that's limited to one specific version but I don't know exactly which ones are impacted. Stating just one specific version isn't all that useful in that case. > > Signed-off-by: Thierry Reding > > --- > > drivers/pwm/pwm-sun4i.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c > > index 0decc7cde133..3e3efa6c768f 100644 > > I don't find this object (0decc7cde133) in my tree or next. Which > version is this? I made this on top of my local pwm/for-next when I was build-testing, which I usually do before pushing, so it's not surprising that you don't have this in your tree. > > > --- a/drivers/pwm/pwm-sun4i.c > > +++ b/drivers/pwm/pwm-sun4i.c > > @@ -234,9 +234,9 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > > { > > struct sun4i_pwm_chip *sun4i_pwm = to_sun4i_pwm_chip(chip); > > struct pwm_state cstate; > > - u32 ctrl, duty, period, val; > > + u32 ctrl, duty = 0, period = 0, val; > > + u32 ctrl, uninitialized_var(duty), uninitialized_var(period), val; > > should fix the warnings, too, and additionally explicitly documents that > it's just the compiler that doesn't see there is no problem. I haven't convinced myself fully yet that there really isn't a problem. I'm fairly sure it's safe, but always initializing to 0 doesn't hurt. Thierry