From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Pavel Machek <pavel@ucw.cz>,
Thierry Reding <thierry.reding@gmail.com>,
Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>,
Lee Jones <lee.jones@linaro.org>,
Satya Priya Kakitapalli <c_skakit@qti.qualcomm.com>,
Marijn Suijten <marijn.suijten@somainline.org>,
Luca Weiss <luca@z3ntu.xyz>, Rob Herring <robh+dt@kernel.org>,
linux-leds@vger.kernel.org,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
linux-pwm <linux-pwm@vger.kernel.org>
Subject: Re: [PATCH v12 2/2] leds: Add driver for Qualcomm LPG
Date: Fri, 18 Feb 2022 08:58:02 -0800 [thread overview]
Message-ID: <Yg/QGqQhYZY6KaqJ@ripper> (raw)
In-Reply-To: <CAD=FV=Xj5k7JROP1PFY9tmXxLY7FRJNdr-+UmkCW_YGqpDkFew@mail.gmail.com>
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@linaro.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
prev parent reply other threads:[~2022-02-18 16:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 4:56 [PATCH v12 1/2] dt-bindings: leds: Add Qualcomm Light Pulse Generator binding Bjorn Andersson
2022-02-16 4:56 ` [PATCH v12 2/2] leds: Add driver for Qualcomm LPG Bjorn Andersson
2022-02-16 19:53 ` Luca Weiss
2022-02-18 16:10 ` Doug Anderson
2022-02-18 16:58 ` Bjorn Andersson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yg/QGqQhYZY6KaqJ@ripper \
--to=bjorn.andersson@linaro.org \
--cc=c_skakit@qti.qualcomm.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=luca@z3ntu.xyz \
--cc=marijn.suijten@somainline.org \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).