hwmon: (w83791d) Remove duplicate NULL check

Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Marc Hulsman <m.hulsman@tudelft.nl>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Andy Shevchenko 2017-10-31 16:21:44 +02:00 committed by Guenter Roeck
parent 0ab21d0edb
commit 416c2a6a6b
1 changed files with 5 additions and 10 deletions

View File

@ -1316,7 +1316,6 @@ static int w83791d_detect_subclients(struct i2c_client *client)
/* Undo inits in case of errors */ /* Undo inits in case of errors */
error_sc_1: error_sc_1:
if (data->lm75[0] != NULL)
i2c_unregister_device(data->lm75[0]); i2c_unregister_device(data->lm75[0]);
error_sc_0: error_sc_0:
return err; return err;
@ -1434,9 +1433,7 @@ error5:
error4: error4:
sysfs_remove_group(&client->dev.kobj, &w83791d_group); sysfs_remove_group(&client->dev.kobj, &w83791d_group);
error3: error3:
if (data->lm75[0] != NULL)
i2c_unregister_device(data->lm75[0]); i2c_unregister_device(data->lm75[0]);
if (data->lm75[1] != NULL)
i2c_unregister_device(data->lm75[1]); i2c_unregister_device(data->lm75[1]);
return err; return err;
} }
@ -1448,9 +1445,7 @@ static int w83791d_remove(struct i2c_client *client)
hwmon_device_unregister(data->hwmon_dev); hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &w83791d_group); sysfs_remove_group(&client->dev.kobj, &w83791d_group);
if (data->lm75[0] != NULL)
i2c_unregister_device(data->lm75[0]); i2c_unregister_device(data->lm75[0]);
if (data->lm75[1] != NULL)
i2c_unregister_device(data->lm75[1]); i2c_unregister_device(data->lm75[1]);
return 0; return 0;