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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=Uf3JiNf=339ktULYSUjreRU2k_tR2Q=LSNb+u-U4hQ6A@mail.gmail.com>
Date:   Mon, 28 Nov 2022 14:48:28 -0800
From:   Doug Anderson <dianders@...omium.org>
To:     Matthias Kaehlcke <mka@...omium.org>
Cc:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Banajit Goswami <bgoswami@...cinc.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        Srinivasa Rao Mandadapu <quic_srivasam@...cinc.com>,
        linux-kernel@...r.kernel.org, Judy Hsiao <judyhsiao@...gle.com>
Subject: Re: [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret'
 at the end of _resume()

Hi,

On Mon, Nov 28, 2022 at 2:12 PM Matthias Kaehlcke <mka@...omium.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@...omium.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ