hwmon: Fix unchecked return status,
PATCH 29/39 hwmon: Fix unchecked return status,
From: Mark M. Hoffman <mhoffman at lightlink.com>
hwmon: Fix unchecked return status, batch 2
Fix up some hwmon drivers so that they no longer ignore return status from device_create_file().
Signed-off-by Mark M. Hoffman <mhoffman at lightlink.com>
Signed-off-by Jean Delvare <khali at linux-fr.org>
Signed-off-by Greg Kroah-Hartman <gregkh at suse.de>
--- drivers/hwmon/lm77.c | 33 ++++++--- drivers/hwmon/lm80.c | 85 +++++++++++++--------- drivers/hwmon/lm85.c | 173 +++++++++++++++++++++++++++------------------ drivers/hwmon/lm87.c | 191 ++++++++++++++++++++++++++++++++++++-------------- drivers/hwmon/lm92.c | 34 ++++++--- 5 files changed, 338 insertions(+), 178 deletions(-)
drivers/hwmon/lm77.c +24 -9
@@ -212,6 +212,23 @@ static int lm77_attach_adapter(struct i2return i2c_probe (adapter, &addr_data, lm77_detect); } +static struct attribute *lm77_attributes[] = { + &dev_attr_temp1_input.attr, + &dev_attr_temp1_crit.attr, + &dev_attr_temp1_min.attr, + &dev_attr_temp1_max.attr, + &dev_attr_temp1_crit_hyst.attr, + &dev_attr_temp1_min_hyst.attr, + &dev_attr_temp1_max_hyst.attr, + &dev_attr_alarms.attr, + +NULL +}; + +static const struct attribute_group lm77_group = { + .attrs = lm77_attributes, +}; +/* This function is called by i2c_probe */ static int lm77_detect (struct i2c_adapter *adapter,int address,int kind) {
@@ -317,22 +334,19 @@ static int lm77_detect(struct i2c_adaptelm77_init_client (new_client);/* Register sysfs hooks */ +if ((err =sysfs_create_group (&new_client->dev.kobj, &lm77_group))) + goto exit_detach; + data->class_dev =hwmon_device_register (&new_client->dev);if (IS_ERR (data->class_dev)) { err =PTR_ERR (data->class_dev); - goto exit_detach; + goto exit_remove; } -device_create_file (&new_client->dev, &dev_attr_temp1_input); -device_create_file (&new_client->dev, &dev_attr_temp1_crit); -device_create_file (&new_client->dev, &dev_attr_temp1_min); -device_create_file (&new_client->dev, &dev_attr_temp1_max); -device_create_file (&new_client->dev, &dev_attr_temp1_crit_hyst); -device_create_file (&new_client->dev, &dev_attr_temp1_min_hyst); -device_create_file (&new_client->dev, &dev_attr_temp1_max_hyst); -device_create_file (&new_client->dev, &dev_attr_alarms);return 0 ; +exit_remove: +sysfs_remove_group (&new_client->dev.kobj, &lm77_group); exit_detach:i2c_detach_client (new_client); exit_free:
@@ -345,6 +359,7 @@ static int lm77_detach_client(struct i2c {struct lm77_data *data =i2c_get_clientdata (client);hwmon_device_unregister (data->class_dev); +sysfs_remove_group (&client->dev.kobj, &lm77_group);i2c_detach_client (client);kfree (data);return 0 ;
drivers/hwmon/lm80.c +49 -36
110 lines not on this page · raw message
drivers/hwmon/lm85.c +102 -71
201 lines not on this page · raw message
drivers/hwmon/lm87.c +139 -52
228 lines not on this page · raw message
drivers/hwmon/lm92.c +24 -10
@@ -288,6 +288,23 @@ static int max6635_check(struct i2c_cliereturn 1 ; } +static struct attribute *lm92_attributes[] = { + &dev_attr_temp1_input.attr, + &dev_attr_temp1_crit.attr, + &dev_attr_temp1_crit_hyst.attr, + &dev_attr_temp1_min.attr, + &dev_attr_temp1_min_hyst.attr, + &dev_attr_temp1_max.attr, + &dev_attr_temp1_max_hyst.attr, + &dev_attr_alarms.attr, + +NULL +}; + +static const struct attribute_group lm92_group = { + .attrs = lm92_attributes, +}; +/* The following function does more than just detection. If detection succeeds, it also registers the new chip. */ static int lm92_detect (struct i2c_adapter *adapter,int address,int kind)
@@ -359,23 +376,19 @@ static int lm92_detect(struct i2c_adaptelm92_init_client (new_client);/* Register sysfs hooks */ +if ((err =sysfs_create_group (&new_client->dev.kobj, &lm92_group))) + goto exit_detach; + data->class_dev =hwmon_device_register (&new_client->dev);if (IS_ERR (data->class_dev)) { err =PTR_ERR (data->class_dev); - goto exit_detach; + goto exit_remove; } -device_create_file (&new_client->dev, &dev_attr_temp1_input); -device_create_file (&new_client->dev, &dev_attr_temp1_crit); -device_create_file (&new_client->dev, &dev_attr_temp1_crit_hyst); -device_create_file (&new_client->dev, &dev_attr_temp1_min); -device_create_file (&new_client->dev, &dev_attr_temp1_min_hyst); -device_create_file (&new_client->dev, &dev_attr_temp1_max); -device_create_file (&new_client->dev, &dev_attr_temp1_max_hyst); -device_create_file (&new_client->dev, &dev_attr_alarms); -return 0 ; +exit_remove: +sysfs_remove_group (&new_client->dev.kobj, &lm92_group); exit_detach:i2c_detach_client (new_client); exit_free:
@@ -397,6 +410,7 @@ static int lm92_detach_client(struct i2cint err;hwmon_device_unregister (data->class_dev); +sysfs_remove_group (&client->dev.kobj, &lm92_group);if ((err =i2c_detach_client (client)))return err;
Signature · 1 line
1.4.2.1