From: "yukuai (C)" <yukuai3@huawei.com>
To: Stephen Boyd <sboyd@kernel.org>, <dinguyen@kernel.org>,
<mturquette@baylibre.com>, <s.trumtrar@pengutronix.de>
Cc: <linux-clk@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<yi.zhang@huawei.com>
Subject: Re: [PATCH] clk: socfpga: remove set but not used variable 'rc'
Date: Wed, 2 Jun 2021 16:11:56 +0800 [thread overview]
Message-ID: <86e34f50-ad3b-f34a-c5dd-0849496ffd67@huawei.com> (raw)
In-Reply-To: <162262008540.4130789.916741380026683860@swboyd.mtv.corp.google.com>
On 2021/06/02 15:48, Stephen Boyd wrote:
> Quoting Yu Kuai (2021-05-13 23:22:34)
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/clk/socfpga/clk-pll.c:83:6: warning: variable ‘rc’ set but
>> not used [-Wunused-but-set-variable]
>>
>> The returned value of of_clk_add_provider() is never used, and so
>> can be removed.
>>
>> Fixes: 97259e99bdc9 ("clk: socfpga: split clk code")
>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>> ---
>> drivers/clk/socfpga/clk-pll.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c
>> index dcb573d44034..127cc849c5ee 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", ®);
>> @@ -114,7 +113,7 @@ static __init struct clk_hw *__socfpga_pll_init(struct device_node *node,
>> kfree(pll_clk);
>> return ERR_PTR(err);
>> }
>> - rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
>> + of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
>
> Shouldn't we fail if of_clk_add_provider() fails? So return some sort of
> error pointer and unwind allocations, etc.
Will send a v2 patch. By the way, do you think it's better to
return error pointer instead of NULL pointer when kzalloc() failed?
Thanks
Yu Kuai
>
>> return hw_clk;
>> }
>>
> .
>
next prev parent reply other threads:[~2021-06-02 8:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 6:22 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) [this message]
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
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=86e34f50-ad3b-f34a-c5dd-0849496ffd67@huawei.com \
--to=yukuai3@huawei.com \
--cc=dinguyen@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=s.trumtrar@pengutronix.de \
--cc=sboyd@kernel.org \
--cc=yi.zhang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®