clean up and warnings patch for 2.6.12-rc4-mm1 i2c-chip
A message that is not in the archive (sent off-list or not yet received): [email protected]
drivers/i2c/chips/max1619.c static int max1619_detect(struct i2c_ada · line 199
Quoted 9 lines · Alexey Fisher
diff -uprN
linux/drivers/i2c/chips/max1619.clinux-2.6-dev/drivers/i2c/chips/max1619.cdrivers/i2c/chips/max1619.c +1
-0@@ -195,6 +195,7 @@ static int max1619_detect(struct i2c_adau8 reg_config=0 , reg_convrate=0 , reg_status=0 ;u8 man_id, chip_id;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA )) + err = -ENODEV ; goto exit;
Sure about that, I think there are some brackets missing.
drivers/i2c/chips/max1619.c static int max1619_detect(struct i2c_ada · line 241
Quoted 9 lines
drivers/i2c/chips/max1619.c +1
-0if (!(data =kmalloc (sizeof (struct max1619_data ),GFP_KERNEL ))) {@@ -234,6 +235,7 @@ static int max1619_detect(struct i2c_adadev_dbg (&adapter->dev,"MAX1619 detection failed at 0x%02x.\n" , address); +return -ENODEV ; goto exit_free; } }
I would expect gcc to throw a warning about unreachable code here because goto exit_free ist behind a return statement. Don't you mean
err = -ENODEV;
goto exit_free;
That way the data structure data will be freed, too.
drivers/i2c/chips/max1619.c static int max1619_detect(struct i2c_ada · line 261
Quoted 7 lines
drivers/i2c/chips/max1619.c +1
-0@@ -254,6 +256,7 @@ static int max1619_detect(struct i2c_adadev_info (&adapter->dev,"Unsupported chip (man_id=0x%02X, " "chip_id=0x%02X).\n" , man_id, chip_id); +return -ENODEV ; goto exit_free; }
Same here.
I am not using this driver and am not fully up to date with the kernel sources so I am sorry if I am talking nonesense here.
Bye Daniel