lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 18 Feb 2022 08:58:02 -0800
From:   Bjorn Andersson <bjorn.andersson@...aro.org>
To:     Doug Anderson <dianders@...omium.org>
Cc:     Pavel Machek <pavel@....cz>,
        Thierry Reding <thierry.reding@...il.com>,
        Uwe Kleine-K?nig <u.kleine-koenig@...gutronix.de>,
        Lee Jones <lee.jones@...aro.org>,
        Satya Priya Kakitapalli <c_skakit@....qualcomm.com>,
        Marijn Suijten <marijn.suijten@...ainline.org>,
        Luca Weiss <luca@...tu.xyz>, Rob Herring <robh+dt@...nel.org>,
        linux-leds@...r.kernel.org,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
        linux-pwm <linux-pwm@...r.kernel.org>
Subject: Re: [PATCH v12 2/2] leds: Add driver for Qualcomm LPG

On Fri 18 Feb 08:10 PST 2022, Doug Anderson wrote:

> Hi,
> 
> On Tue, Feb 15, 2022 at 8:54 PM Bjorn Andersson
> <bjorn.andersson@...aro.org> wrote:
> >
> > +static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> > +                        const struct pwm_state *state)
> > +{
> > +       struct lpg *lpg = container_of(chip, struct lpg, pwm);
> > +       struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
> > +       int ret;
> > +
> > +       if (state->polarity != PWM_POLARITY_NORMAL)
> > +               return -EINVAL;
> > +
> > +       mutex_lock(&lpg->lock);
> > +
> > +       if (state->enabled) {
> > +               ret = lpg_calc_freq(chan, state->period);
> > +               if (ret < 0)
> > +                       goto out_unlock;
> > +
> > +               lpg_calc_duty(chan, state->duty_cycle);
> > +       }
> > +       chan->enabled = state->enabled;
> > +
> > +       lpg_apply(chan);
> > +
> > +       triled_set(lpg, chan->triled_mask, chan->enabled ? chan->triled_mask : 0);
> > +
> > +out_unlock:
> > +       mutex_unlock(&lpg->lock);
> > +
> > +       return ret;
> > +}
> 
> My compiler (correctly) yelled that `ret` is returned uninitialized if
> `state->enabled` is false.

You're absolutely correct. I am however not able to figure out how to
get my compiler (aarc64 gcc 11.2.0) to give me a warning about this.

If anyone have any suggestions I'd be very happy.

> I initialized `ret` to 0 and the problem
> went away. I assume that the patch will need to spin to fix that
> unless everything else looks great and a maintainer wants to fix that
> when applying.
> 
> With that fix, I was able to use Bjorn's patch along with Satya's
> patches adding pm8350c support (removing the now defunct
> "pwm_9bit_mask" property) to make the PWM on my board work. Thus, once
> the error my compiler complained about is fixed I'm happy with my
> `Tested-by` being added.
> 

Thanks! I will initialize ret and send out v13 including your T-b.

Regards,
Bjorn

> For now I haven't actually reviewed the code here, but if folks feel
> like it needs an extra pair of eyes then please yell and I'll find
> some time to do it.
> 
> -Doug

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ