Skip to content

Commit

Permalink
hwmon: (w83793) Remove duplicate NULL check
Browse files Browse the repository at this point in the history
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Rudolf Marek <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Jean Delvare <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
andy-shev authored and groeck committed Nov 16, 2017
1 parent c85a78b commit 7adce42
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions drivers/hwmon/w83793.c
Original file line number Diff line number Diff line change
Expand Up @@ -1564,10 +1564,8 @@ static int w83793_remove(struct i2c_client *client)
for (i = 0; i < ARRAY_SIZE(w83793_temp); i++)
device_remove_file(dev, &w83793_temp[i].dev_attr);

if (data->lm75[0] != NULL)
i2c_unregister_device(data->lm75[0]);
if (data->lm75[1] != NULL)
i2c_unregister_device(data->lm75[1]);
i2c_unregister_device(data->lm75[0]);
i2c_unregister_device(data->lm75[1]);

/* Decrease data reference counter */
mutex_lock(&watchdog_data_mutex);
Expand Down Expand Up @@ -1625,8 +1623,7 @@ w83793_detect_subclients(struct i2c_client *client)
/* Undo inits in case of errors */

ERROR_SC_1:
if (data->lm75[0] != NULL)
i2c_unregister_device(data->lm75[0]);
i2c_unregister_device(data->lm75[0]);
ERROR_SC_0:
return err;
}
Expand Down Expand Up @@ -1962,10 +1959,8 @@ static int w83793_probe(struct i2c_client *client,
for (i = 0; i < ARRAY_SIZE(w83793_temp); i++)
device_remove_file(dev, &w83793_temp[i].dev_attr);

if (data->lm75[0] != NULL)
i2c_unregister_device(data->lm75[0]);
if (data->lm75[1] != NULL)
i2c_unregister_device(data->lm75[1]);
i2c_unregister_device(data->lm75[0]);
i2c_unregister_device(data->lm75[1]);
free_mem:
kfree(data);
exit:
Expand Down

0 comments on commit 7adce42

Please sign in to comment.