* [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() @ 2022-11-28 22:11 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:37 ` [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() Doug Anderson 0 siblings, 2 replies; 5+ messages in thread From: Matthias Kaehlcke @ 2022-11-28 22:11 UTC (permalink / raw) To: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai Cc: alsa-devel, Douglas Anderson, Srinivasa Rao Mandadapu, linux-kernel, Judy Hsiao, Matthias Kaehlcke The initialization of the variable 'ret' in sc7180_lpass_dev_resume() is unnecessary, as it is always assigned a few lines below. Drop the initialization. Signed-off-by: Matthias Kaehlcke <mka@chromium.org> --- sound/soc/qcom/lpass-sc7180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c index 9c3365ddc274..7a81e609727c 100644 --- a/sound/soc/qcom/lpass-sc7180.c +++ b/sound/soc/qcom/lpass-sc7180.c @@ -165,7 +165,7 @@ static int sc7180_lpass_exit(struct platform_device *pdev) static int sc7180_lpass_dev_resume(struct device *dev) { - int ret = 0; + int ret; struct lpass_data *drvdata = dev_get_drvdata(dev); ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks); -- 2.38.1.584.g0f3c55d4c2-goog ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret' at the end of _resume() 2022-11-28 22:11 [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() Matthias Kaehlcke @ 2022-11-28 22:11 ` Matthias Kaehlcke 2022-11-28 22:48 ` Doug Anderson 2022-11-28 22:37 ` [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() Doug Anderson 1 sibling, 1 reply; 5+ messages in thread From: Matthias Kaehlcke @ 2022-11-28 22:11 UTC (permalink / raw) To: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai Cc: alsa-devel, Douglas Anderson, Srinivasa Rao Mandadapu, linux-kernel, Judy Hsiao, Matthias Kaehlcke 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; } static int sc7180_lpass_dev_suspend(struct device *dev) -- 2.38.1.584.g0f3c55d4c2-goog ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret' at the end of _resume() 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 0 siblings, 1 reply; 5+ messages in thread From: Doug Anderson @ 2022-11-28 22:48 UTC (permalink / raw) To: Matthias Kaehlcke Cc: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel, Srinivasa Rao Mandadapu, linux-kernel, Judy Hsiao 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; ...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); I guess theoretically one could even go further and look at pm_clk, but perhaps that's overboard. -Doug ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret' at the end of _resume() 2022-11-28 22:48 ` Doug Anderson @ 2022-11-28 23:57 ` Matthias Kaehlcke 0 siblings, 0 replies; 5+ messages in thread From: Matthias Kaehlcke @ 2022-11-28 23:57 UTC (permalink / raw) To: Doug Anderson Cc: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel, Srinivasa Rao Mandadapu, linux-kernel, Judy Hsiao 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() 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:37 ` Doug Anderson 1 sibling, 0 replies; 5+ messages in thread From: Doug Anderson @ 2022-11-28 22:37 UTC (permalink / raw) To: Matthias Kaehlcke Cc: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel, Srinivasa Rao Mandadapu, linux-kernel, Judy Hsiao Hi, On Mon, Nov 28, 2022 at 2:12 PM Matthias Kaehlcke <mka@chromium.org> wrote: > > The initialization of the variable 'ret' in sc7180_lpass_dev_resume() > is unnecessary, as it is always assigned a few lines below. Drop the > initialization. > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> > --- > > sound/soc/qcom/lpass-sc7180.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Not that this needs review, but FWIW: Reviewed-by: Douglas Anderson <dianders@chromium.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-28 23:57 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2022-11-28 22:37 ` [PATCH 1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume() Doug Anderson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox