misc: eeprom: assignment outside the if statement
PATCH 1/1 misc: eeprom: assignment outside the if statement
Assignment of any variable should be kept outside the if statement
Signed-off-by Parth Y Shah <[email protected]>
--- drivers/misc/eeprom/max6875.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/eeprom/max6875.c +2 -1
@@ -148,7 +148,8 @@ static int max6875_probe(struct i2c_client *client,if (client->addr &1 )return -ENODEV ; -if (!(data =kzalloc (sizeof (struct max6875_data ),GFP_KERNEL ))) + data =kzalloc (sizeof (struct max6875_data ),GFP_KERNEL ); +if (!data)return -ENOMEM ;/* A fake client is created on the odd address */
Signature · 1 line
2.7.4
Quoted 1 line · Parth Y Shah
Assignment of any variable should be kept outside the if statement
Actually there are exceptions to that rule, but this isn't one of them.
Quoted 10 lines
Signed-off-by Parth Y Shah <[email protected]>--- drivers/misc/eeprom/max6875.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/misc/eeprom/max6875.c +0
-0
drivers/misc/eeprom/max6875.c static int max6875_probe(struct i2c_client *client, · line 155
Quoted 9 lines
drivers/misc/eeprom/max6875.c +2
-1@@ -148,7 +148,8 @@ static int max6875_probe(struct i2c_client *client,if (client->addr &1 )return -ENODEV ; -if (!(data =kzalloc (sizeof (struct max6875_data ),GFP_KERNEL ))) + data =kzalloc (sizeof (struct max6875_data ),GFP_KERNEL ); +if (!data)return -ENOMEM ;/* A fake client is created on the odd address */
Reviewed-by Jean Delvare <[email protected]>
Thanks,
Signature · 2 lines
Jean Delvare SUSE L3 Support