All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Yu Kuai <yukuai3@huawei.com>,
	dinguyen@kernel.org, mturquette@baylibre.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	yukuai3@huawei.com, yi.zhang@huawei.com
Subject: Re: [PATCH V2] clk: socfpga: err out if of_clk_add_provider() failed in __socfpga_pll_init()
Date: Wed, 09 Jun 2021 14:57:11 -0700	[thread overview]
Message-ID: <162327583172.9598.16259717139406297542@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20210602084259.1267768-1-yukuai3@huawei.com>

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@huawei.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);
>  }

      parent reply	other threads:[~2021-06-09 21:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  6:22 [PATCH] clk: socfpga: remove set but not used variable 'rc' Yu Kuai
2021-05-14 15:11 ` Dinh Nguyen
2021-05-29  9:06   ` yukuai (C)
2021-06-02  7:48 ` Stephen Boyd
2021-06-02  8:11   ` yukuai (C)
2021-06-02  8:42   ` [PATCH V2] clk: socfpga: err out if of_clk_add_provider() failed in __socfpga_pll_init() Yu Kuai
2021-06-07  9:08     ` yukuai (C)
2021-06-09 21:57     ` Stephen Boyd [this message]

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=162327583172.9598.16259717139406297542@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.