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]
Message-ID: <162327583172.9598.16259717139406297542@swboyd.mtv.corp.google.com>
Date:   Wed, 09 Jun 2021 14:57:11 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Yu Kuai <yukuai3@...wei.com>, dinguyen@...nel.org,
        mturquette@...libre.com
Cc:     linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        yukuai3@...wei.com, yi.zhang@...wei.com
Subject: Re: [PATCH V2] clk: socfpga: err out if of_clk_add_provider() failed in __socfpga_pll_init()

Quoting Yu Kuai (2021-06-02 01:42:59)
> __socfpga_pll_init() should fail if of_clk_add_provider() failed.
> remove 'rc' in the meantime to avoid gcc
> '-Wunused-but-set-variable' warning.
> 
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---

Please don't send as in-reply-to previous patches. Makes it hard for me
to find them on the list.

> changes in V2:
>  - remove 'rc' and use err' instead of 'rc'
>  - err out if of_clk_add_provider() failed
> 
>  drivers/clk/socfpga/clk-pll.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c
> index dcb573d44034..5a9eec2eca80 100644
> --- a/drivers/clk/socfpga/clk-pll.c
> +++ b/drivers/clk/socfpga/clk-pll.c
> @@ -80,7 +80,6 @@ static __init struct clk_hw *__socfpga_pll_init(struct device_node *node,
>         const char *parent_name[SOCFPGA_MAX_PARENTS];
>         struct clk_init_data init;
>         struct device_node *clkmgr_np;
> -       int rc;
>         int err;
>  
>         of_property_read_u32(node, "reg", &reg);
> @@ -110,12 +109,16 @@ static __init struct clk_hw *__socfpga_pll_init(struct device_node *node,
>         hw_clk = &pll_clk->hw.hw;
>  
>         err = clk_hw_register(NULL, hw_clk);
> -       if (err) {
> -               kfree(pll_clk);
> -               return ERR_PTR(err);
> -       }
> -       rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
> +       if (err)
> +               goto err_out;
> +       err = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
> +       if (err)

Now we don't unregister the clk on failure? Can you use
of_clk_add_hw_provider() as well? That would make this more modern. It
can be done as a followup patch to this one.

> +               goto err_out;
>         return hw_clk;
> +
> +err_out:
> +       kfree(pll_clk);
> +       return ERR_PTR(err);
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ