[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f706a87b-fb25-8d63-43e5-9e71a0f8fec8@huawei.com>
Date: Mon, 7 Jun 2021 17:08:01 +0800
From: "yukuai (C)" <yukuai3@...wei.com>
To: <dinguyen@...nel.org>, <mturquette@...libre.com>,
<sboyd@...nel.org>
CC: <linux-clk@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<yi.zhang@...wei.com>
Subject: Re: [PATCH V2] clk: socfpga: err out if of_clk_add_provider() failed
in __socfpga_pll_init()
ping ...
On 2021/06/02 16:42, Yu Kuai wrote:
> __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>
> ---
> 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", ®);
> @@ -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)
> + goto err_out;
> return hw_clk;
> +
> +err_out:
> + kfree(pll_clk);
> + return ERR_PTR(err);
> }
>
> void __init socfpga_pll_init(struct device_node *node)
>
Powered by blists - more mailing lists