Skip to contentSkip to conversation

i2c: i2c-mxs: Fix build warning

PATCH In review Fabio Estevam 2 participants 3 messages Apr 5, 2012 2 messages not in the archive

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

PATCH 1/1 i2c: i2c-mxs: Fix build warning

Fix the following build warning:

drivers/i2c/busses/i2c-mxs.c:207:8: warning: 'data' may be used uninitialized in this function [-Wuninitialized]

---
 drivers/i2c/busses/i2c-mxs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-mxs.c +1 -1
index 3d471d5..6a24a86 100644
@@ -194,7 +194,7 @@ static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
 
 static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
 {
-	u32 data;
+	u32 data = 0;
 	int i;
 
 	for (i = 0; i < len; i++) {
Signature · 1 line
1.7.1

A message that is not in the archive (sent off-list or not yet received): 1333656595-3600-1-git-send-email-festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 5 lines · Fabio Estevam

Fix the following build warning:

drivers/i2c/busses/i2c-mxs.c:207:8: warning: 'data' may be used uninitialized in this function [-Wuninitialized]

Do you agree with the compiler?

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 8 lines · Wolfram Sang
Quoted 5 lines · Fabio Estevam

Fix the following build warning:

drivers/i2c/busses/i2c-mxs.c:207:8: warning: 'data' may be used uninitialized in this function [-Wuninitialized]

Do you agree with the compiler?

After looking at it carefully I conclude that is not possible for 'data' to be used uninitialized.