LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: prevent accessing rate_discrete uninitialized
@ 2018-03-16 11:44 Anders Roxell
2018-03-20 16:36 ` Sudeep Holla
0 siblings, 1 reply; 2+ messages in thread
From: Anders Roxell @ 2018-03-16 11:44 UTC (permalink / raw)
To: sudeep.holla; +Cc: linux-arm-kernel, linux-kernel, Anders Roxell
gcc-5.3 and earlier warns that rate_discrete maybe-uninitialized
../drivers/firmware/arm_scmi/clock.c:185:5: warning: 'rate_discrete'
may be used uninitialized in this function [-Wmaybe-uninitialized]
if (rate_discrete)
^
../drivers/firmware/arm_scmi/clock.c:128:7: note:
'rate_discrete' was declared here
bool rate_discrete;
^
Fixes: 5f6c6430e904 ("firmware: arm_scmi: add initial support for clock protocol")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
drivers/firmware/arm_scmi/clock.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
index e8ffad33a0ff..e6f17825db79 100644
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -125,7 +125,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
{
u64 *rate;
int ret, cnt;
- bool rate_discrete;
+ bool rate_discrete = false;
u32 tot_rate_cnt = 0, rates_flag;
u16 num_returned, num_remaining;
struct scmi_xfer *t;
@@ -147,7 +147,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
ret = scmi_do_xfer(handle, t);
if (ret)
- break;
+ goto err;
rates_flag = le32_to_cpu(rlist->num_rates_flags);
num_remaining = NUM_REMAINING(rates_flag);
@@ -185,6 +185,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
if (rate_discrete)
clk->list.num_rates = tot_rate_cnt;
+err:
scmi_one_xfer_put(handle, t);
return ret;
}
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] firmware: arm_scmi: prevent accessing rate_discrete uninitialized
2018-03-16 11:44 [PATCH] firmware: arm_scmi: prevent accessing rate_discrete uninitialized Anders Roxell
@ 2018-03-20 16:36 ` Sudeep Holla
0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2018-03-20 16:36 UTC (permalink / raw)
To: Anders Roxell; +Cc: Sudeep Holla, linux-arm-kernel, linux-kernel
Hi Anders,
On 16/03/18 11:44, Anders Roxell wrote:
> gcc-5.3 and earlier warns that rate_discrete maybe-uninitialized
> ../drivers/firmware/arm_scmi/clock.c:185:5: warning: 'rate_discrete'
> may be used uninitialized in this function [-Wmaybe-uninitialized]
> if (rate_discrete)
> ^
> ../drivers/firmware/arm_scmi/clock.c:128:7: note:
> 'rate_discrete' was declared here
> bool rate_discrete;
> ^
>
Thanks for the fix, applied.
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-20 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 11:44 [PATCH] firmware: arm_scmi: prevent accessing rate_discrete uninitialized Anders Roxell
2018-03-20 16:36 ` Sudeep Holla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).