diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-10-31 10:21:44 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2017-11-16 04:02:23 -0500 |
commit | 416c2a6a6ba96926ef585b574f509e1c6c6440ab (patch) | |
tree | 2217b4441e7f372b35b38c75041f93f8c73e6d57 | |
parent | 0ab21d0edb5deba027460961baf49433246853db (diff) |
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>
-rw-r--r-- | drivers/hwmon/w83791d.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index 8af6081b4ab4..28fa3bd2c096 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c | |||
@@ -1316,8 +1316,7 @@ static int w83791d_detect_subclients(struct i2c_client *client) | |||
1316 | /* Undo inits in case of errors */ | 1316 | /* Undo inits in case of errors */ |
1317 | 1317 | ||
1318 | error_sc_1: | 1318 | error_sc_1: |
1319 | if (data->lm75[0] != NULL) | 1319 | i2c_unregister_device(data->lm75[0]); |
1320 | i2c_unregister_device(data->lm75[0]); | ||
1321 | error_sc_0: | 1320 | error_sc_0: |
1322 | return err; | 1321 | return err; |
1323 | } | 1322 | } |
@@ -1434,10 +1433,8 @@ error5: | |||
1434 | error4: | 1433 | error4: |
1435 | sysfs_remove_group(&client->dev.kobj, &w83791d_group); | 1434 | sysfs_remove_group(&client->dev.kobj, &w83791d_group); |
1436 | error3: | 1435 | error3: |
1437 | if (data->lm75[0] != NULL) | 1436 | i2c_unregister_device(data->lm75[0]); |
1438 | i2c_unregister_device(data->lm75[0]); | 1437 | i2c_unregister_device(data->lm75[1]); |
1439 | if (data->lm75[1] != NULL) | ||
1440 | i2c_unregister_device(data->lm75[1]); | ||
1441 | return err; | 1438 | return err; |
1442 | } | 1439 | } |
1443 | 1440 | ||
@@ -1448,10 +1445,8 @@ static int w83791d_remove(struct i2c_client *client) | |||
1448 | hwmon_device_unregister(data->hwmon_dev); | 1445 | hwmon_device_unregister(data->hwmon_dev); |
1449 | sysfs_remove_group(&client->dev.kobj, &w83791d_group); | 1446 | sysfs_remove_group(&client->dev.kobj, &w83791d_group); |
1450 | 1447 | ||
1451 | if (data->lm75[0] != NULL) | 1448 | i2c_unregister_device(data->lm75[0]); |
1452 | i2c_unregister_device(data->lm75[0]); | 1449 | i2c_unregister_device(data->lm75[1]); |
1453 | if (data->lm75[1] != NULL) | ||
1454 | i2c_unregister_device(data->lm75[1]); | ||
1455 | 1450 | ||
1456 | return 0; | 1451 | return 0; |
1457 | } | 1452 | } |