Skip to contentSkip to conversation

fsl_i2c: Fix used uninitialized variable

PATCH New Jean-Christophe PLAGNIOL-VILLARD 3 participants 4 messages Apr 1, 2008 I2C

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsl_i2c: Fix used uninitialized variable

fsl_i2c.c: In function 'set_i2c_bus_speed':
fsl_i2c.c:120: warning: 'dfsr' may be used uninitialized in this function fsl_i2c.c:120: warning: 'fdr' may be used uninitialized in this function

drivers/i2c/fsl_i2c.c +2 -1
index dde0571..917a4ba 100644
@@ -117,7 +117,8 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c *dev,
 {
 	unsigned short divider = min(i2c_clk / speed, (unsigned short) -1);
 	unsigned int i;
-	u8 fdr, dfsr;
+	u8 fdr = 0x3F;
+	u8 dfsr = 0x3F;
 
 	/*
 	 * We want to choose an FDR/DFSR that generates an I2C bus speed that
Signature · 1 line
1.5.4.5
#1 lore raw

PATCH 1/1 fsl_i2c: Fix used uninitialized variable

Quoted 23 lines · Jean-Christophe PLAGNIOL-VILLARD

fsl_i2c.c: In function 'set_i2c_bus_speed':
fsl_i2c.c:120: warning: 'dfsr' may be used uninitialized in this function
fsl_i2c.c:120: warning: 'fdr' may be used uninitialized in this function

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD
<[email protected]>

drivers/i2c/fsl_i2c.c +2 -1
index dde0571..917a4ba 100644
@@ -117,7 +117,8 @@ static unsigned int set_i2c_bus_speed(const  
 struct fsl_i2c *dev,
 {
 	unsigned short divider = min(i2c_clk / speed, (unsigned short) -1);
 	unsigned int i;
-	u8 fdr, dfsr;
+	u8 fdr = 0x3F;
+	u8 dfsr = 0x3F;
 
 	/*
Quoted 3 lines

* We want to choose an FDR/DFSR that generates an I2C bus speed that

Signature · 1 line
1.5.4.5

I posted a patch that moved fdr, dfsr inside the loop to fix the warnings.

- k

#2 lore raw

PATCH 1/1 fsl_i2c: Fix used uninitialized variable

Quoted 21 lines · Kumar Gala
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD

fsl_i2c.c: In function 'set_i2c_bus_speed':
fsl_i2c.c:120: warning: 'dfsr' may be used uninitialized in this function fsl_i2c.c:120: warning: 'fdr' may be used uninitialized in this function

drivers/i2c/fsl_i2c.c +2 -1
index dde0571..917a4ba 100644
@@ -117,7 +117,8 @@ static unsigned int set_i2c_bus_speed(const struct 
 fsl_i2c *dev,
 {
 	unsigned short divider = min(i2c_clk / speed, (unsigned short) -1);
 	unsigned int i;
-	u8 fdr, dfsr;
+	u8 fdr = 0x3F;
+	u8 dfsr = 0x3F;
 
Quoted 6 lines
Quoted 4 lines
drivers/i2c/fsl_i2c.c +0 -0
 	/*

* We want to choose an FDR/DFSR that generates an I2C bus speed that

Signature · 1 line
1.5.4.5

I posted a patch that moved fdr, dfsr inside the loop to fix the warnings.

Not Found could you give the subject please

Best Regards,
J.

#3 lore raw

PATCH 1/1 fsl_i2c: Fix used uninitialized variable

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

I posted a patch that moved fdr, dfsr inside the loop to fix the warnings.

Not Found could you give the subject please

7607 03/26 Kumar Gala [U-Boot-Users] [PATCH] Fix warnings introduced by I2C bus speed setti

It's on my todo list.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In Nature there are neither rewards nor punishments, there are conse-
quences.                                            -- R.G. Ingersoll