Skip to contentSkip to conversation

clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

PATCH New Boris Brezillon 5 participants 8 messages Dec 12, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")
---
 drivers/clk/bcm/clk-bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm2835.c +1 -1
index eaf82f49dede..0d14409097e7 100644
@@ -1029,7 +1029,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw,
 	struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
 	struct bcm2835_cprman *cprman = clock->cprman;
 	const struct bcm2835_clock_data *data = clock->data;
-	unsigned long best_rate;
+	unsigned long best_rate = 0;
 	u32 curdiv, mindiv, maxdiv;
 	struct clk_hw *parent;
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

Quoted 5 lines · CET Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")

I wonder why I didn't get that. Which compiler version did you use?

Arnd

#2 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

Hi Arnd,

Quoted 9 lines · On Mon, 12 Dec 2016 09:12:36 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 5 lines · CET Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")

I wonder why I didn't get that. Which compiler version did you use?

Gcc-5.2.0 powerpc-le hosted cross compiler.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

In reply to Arnd Bergmann
Quoted 9 lines · On Mon, 12 Dec 2016 09:12:36 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 5 lines · CET Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")

I wonder why I didn't get that. Which compiler version did you use?

In case you're interested, my gcc [1] failed to detect it as well, and this is not the first time it happens :-/.

[1]gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

#4 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

Quoted 10 lines · CET Boris Brezillon
Quoted 7 lines · On Mon, 12 Dec 2016 09:12:36 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 5 lines · CET Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")
Quoted 7 lines
Quoted 2 lines

I wonder why I didn't get that. Which compiler version did you use?

In case you're interested, my gcc [1] failed to detect it as well, and this is not the first time it happens :-/.

[1]gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

No, I see it now with gcc-7, it only just turned up in linux-next.

I ran into it right away with an allmodconfig build. You were probably testing based on an earlier v4.9-rc release that had the warning globally disabled.

Arnd

#5 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

Quoted 17 lines · On Mon, 12 Dec 2016 09:34:28 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 16 lines · CET Boris Brezillon
Quoted 9 lines · On Mon, 12 Dec 2016 09:12:36 +0100 Arnd Bergmann <[email protected]> wrote:
Quoted 5 lines · CET Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")

I wonder why I didn't get that. Which compiler version did you use?

In case you're interested, my gcc [1] failed to detect it as well, and this is not the first time it happens :-/.

Quoted 7 lines
Quoted 1 line

[1]gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

No, I see it now with gcc-7, it only just turned up in linux-next.

I ran into it right away with an allmodconfig build. You were probably testing based on an earlier v4.9-rc release that had the warning globally disabled.

Indeed, I was testing on a 4.9-rc.

#6 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

In reply to Boris Brezillon
Quoted 5 lines · Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161212/65cadde3/attachment.sig>

Applied
#7 lore raw

PATCH 1/1 clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate()

In reply to Boris Brezillon
Quoted 6 lines · Boris Brezillon

best_rate is reported as potentially uninitialized by gcc.

Fixes 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project