diff mbox

[U-Boot,v2,6/7] board: iocon: Fix uninitialized access

Message ID 1415902878-4291-7-git-send-email-dirk.eibach@gdsys.cc
State Awaiting Upstream
Delegated to: Stefan Roese
Headers show

Commit Message

Dirk Eibach Nov. 13, 2014, 6:21 p.m. UTC
From: Dirk Eibach <dirk.eibach@gdsys.cc>

Wolfgang Denk found this issue using cppcheck:
(error) Uninitialized variable: fpga_features

Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
---

Changes in v2:
- fix cppcheck finding reported by Wolfgang

 board/gdsys/405ep/iocon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stefan Roese Nov. 19, 2014, 7:56 a.m. UTC | #1
On 13.11.2014 19:21, dirk.eibach@gdsys.cc wrote:
> From: Dirk Eibach <dirk.eibach@gdsys.cc>
>
> Wolfgang Denk found this issue using cppcheck:
> (error) Uninitialized variable: fpga_features
>
> Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>

Applied to u-boot-ppc4xx/master.

Thanks,
Stefan
diff mbox

Patch

diff --git a/board/gdsys/405ep/iocon.c b/board/gdsys/405ep/iocon.c
index fffed73..1d7e141 100644
--- a/board/gdsys/405ep/iocon.c
+++ b/board/gdsys/405ep/iocon.c
@@ -369,10 +369,11 @@  int last_stage_init(void)
 	unsigned char mclink_controllers[] = { 0x24, 0x25, 0x26 };
 	int legacy = get_fpga_state(0) & FPGA_STATE_PLATFORM;
 	u16 fpga_features;
-	int feature_carrier_speed = fpga_features & (1<<4);
+	int feature_carrier_speed;
 	bool ch0_rgmii2_present = false;
 
 	FPGA_GET_REG(0, fpga_features, &fpga_features);
+	feature_carrier_speed = fpga_features & (1<<4);
 
 	if (!legacy) {
 		/* Turn on Parade DP501 */