Skip to contentSkip to conversation

mfd: Avoid writing uninitialized value to device

PATCH In review Axel Lin 3 participants 3 messages Dec 8, 2011 – Dec 19, 2011 Multifunction devices (MFD)

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 mfd: Avoid writing uninitialized value to device

Avoid writing uninitialized value to device by explicitly initialize zero to 0.

---
 drivers/mfd/88pm860x-i2c.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/88pm860x-i2c.c +2 -2
index e017dc8..fcde8a3 100644
@@ -151,7 +151,7 @@ int pm860x_page_reg_write(struct i2c_client *i2c, int reg,
 			  unsigned char data)
 {
 	struct pm860x_chip *chip = i2c_get_clientdata(i2c);
-	unsigned char zero;
+	unsigned char zero = 0;
 	int ret;
 
 	mutex_lock(&chip->io_lock);
@@ -208,7 +208,7 @@ int pm860x_page_set_bits(struct i2c_client *i2c, int reg,
 			 unsigned char mask, unsigned char data)
 {
 	struct pm860x_chip *chip = i2c_get_clientdata(i2c);
-	unsigned char zero;
+	unsigned char zero = 0;
 	unsigned char value;
 	int ret;
 
Signature · 1 line
1.7.5.4
#2 lore raw
In reply to Axel Lin

Hi Axel,

Quoted 2 lines · Axel Lin

Avoid writing uninitialized value to device by explicitly initialize zero to 0.

88pm860x is now using the regmap API, so this patch is no longer relevant.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/