From: Matthias Kaehlcke <mka@chromium.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Judy Hsiao <judyhsiao@google.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Banajit Goswami <bgoswami@quicinc.com>,
Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Subject: Re: [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret' at the end of _resume()
Date: Mon, 28 Nov 2022 23:57:26 +0000 [thread overview]
Message-ID: <Y4VK5ijXW7Kqnfjn@google.com> (raw)
In-Reply-To: <CAD=FV=Uf3JiNf=339ktULYSUjreRU2k_tR2Q=LSNb+u-U4hQ6A@mail.gmail.com>
On Mon, Nov 28, 2022 at 02:48:28PM -0800, Doug Anderson wrote:
> Hi,
>
> On Mon, Nov 28, 2022 at 2:12 PM Matthias Kaehlcke <mka@chromium.org> wrote:
> >
> > sc7180_lpass_dev_resume() returns 'ret' at the end of the function,
> > where 'ret' is always 0. Just return 0 to make it plain obvious that
> > this is always the success path.
> >
> > Also add an empty line between the error handling path and the
> > return.
> >
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> >
> > sound/soc/qcom/lpass-sc7180.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
> > index 7a81e609727c..30a28e3152cb 100644
> > --- a/sound/soc/qcom/lpass-sc7180.c
> > +++ b/sound/soc/qcom/lpass-sc7180.c
> > @@ -173,7 +173,8 @@ static int sc7180_lpass_dev_resume(struct device *dev)
> > dev_err(dev, "sc7180 clk prepare and enable failed\n");
> > return ret;
> > }
> > - return ret;
> > +
> > + return 0;
>
> Yeah, I noticed this too when I was approving your pick. FWIW, I
> probably would have written this way, but it's 6 of one and half dozen
> of the other:
>
> if (ret)
> dev_err(dev, ...);
> return ret;
Yeah, I was considering this too, either is fine IMO :)
> ...but I just dug a tiny bit deeper and actually, there's no need for
> the error print here and it's just wasteful. clk_bulk_prepare_enable()
> already prints errors for you. So really this whole function could
> just be:
>
> struct lpass_data *drvdata = dev_get_drvdata(dev);
> return clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
Right, the log isn't really needed if clk_bulk_prepare_enable() already
logs errors. I'll adjust the patch accordingly, and drop the first one
since 'ret' is going away.
> I guess theoretically one could even go further and look at pm_clk,
> but perhaps that's overboard.
Maybe let's leave that for another iteration :)
Thanks for the review!
m.
next prev parent reply other threads:[~2022-11-28 23:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 22:11 [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() Matthias Kaehlcke
2022-11-28 22:11 ` [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret' at the end of _resume() Matthias Kaehlcke
2022-11-28 22:48 ` Doug Anderson
2022-11-28 23:57 ` Matthias Kaehlcke [this message]
2022-11-28 22:37 ` [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() Doug Anderson
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=Y4VK5ijXW7Kqnfjn@google.com \
--to=mka@chromium.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=judyhsiao@google.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_srivasam@quicinc.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
/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).