misc: eeprom: assignment outside the if statement
authorParth Y Shah <sparth1292@gmail.com>
Fri, 3 Aug 2018 09:20:43 +0000 (14:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Aug 2018 14:25:10 +0000 (16:25 +0200)
Assignment of any variable should be kept outside the if statement

Signed-off-by: Parth Y Shah <sparth1292@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/eeprom/max6875.c

index 0e32709d1022550d348da60961da30fc3b8cc30a..fc0cf9a7402e937d6a86fac266dc44980c47c246 100644 (file)
@@ -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 */