diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-09-24 15:24:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:19 -0400 |
commit | a5ebe668add5f76ed8f01f752b37cfa164a26a30 (patch) | |
tree | 116324063bd55666d0fa23db4342d5bd097518be /drivers/hwmon/ds1621.c | |
parent | f52f79da2908796a0fa1e7bbbe0d5ff20183d75f (diff) |
hwmon: Fix unchecked return status, batch 6
hwmon: Fix unchecked return status, batch 6
Fix up 5 more hwmon drivers so that they no longer ignore return status
from device_create_file().
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/ds1621.c')
-rw-r--r-- | drivers/hwmon/ds1621.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 478eb4bb8570..c849c0c6ee9c 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/hwmon.h> | 29 | #include <linux/hwmon.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/sysfs.h> | ||
32 | #include "lm75.h" | 33 | #include "lm75.h" |
33 | 34 | ||
34 | /* Addresses to scan */ | 35 | /* Addresses to scan */ |
@@ -178,6 +179,18 @@ static DEVICE_ATTR(temp1_input, S_IRUGO , show_temp, NULL); | |||
178 | static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO , show_temp_min, set_temp_min); | 179 | static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO , show_temp_min, set_temp_min); |
179 | static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); | 180 | static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); |
180 | 181 | ||
182 | static struct attribute *ds1621_attributes[] = { | ||
183 | &dev_attr_temp1_input.attr, | ||
184 | &dev_attr_temp1_min.attr, | ||
185 | &dev_attr_temp1_max.attr, | ||
186 | &dev_attr_alarms.attr, | ||
187 | NULL | ||
188 | }; | ||
189 | |||
190 | static const struct attribute_group ds1621_group = { | ||
191 | .attrs = ds1621_attributes, | ||
192 | }; | ||
193 | |||
181 | 194 | ||
182 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) | 195 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) |
183 | { | 196 | { |
@@ -253,21 +266,19 @@ static int ds1621_detect(struct i2c_adapter *adapter, int address, | |||
253 | ds1621_init_client(new_client); | 266 | ds1621_init_client(new_client); |
254 | 267 | ||
255 | /* Register sysfs hooks */ | 268 | /* Register sysfs hooks */ |
269 | if ((err = sysfs_create_group(&new_client->dev.kobj, &ds1621_group))) | ||
270 | goto exit_detach; | ||
271 | |||
256 | data->class_dev = hwmon_device_register(&new_client->dev); | 272 | data->class_dev = hwmon_device_register(&new_client->dev); |
257 | if (IS_ERR(data->class_dev)) { | 273 | if (IS_ERR(data->class_dev)) { |
258 | err = PTR_ERR(data->class_dev); | 274 | err = PTR_ERR(data->class_dev); |
259 | goto exit_detach; | 275 | goto exit_remove_files; |
260 | } | 276 | } |
261 | 277 | ||
262 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
263 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
264 | device_create_file(&new_client->dev, &dev_attr_temp1_min); | ||
265 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
266 | |||
267 | return 0; | 278 | return 0; |
268 | 279 | ||
269 | /* OK, this is not exactly good programming practice, usually. But it is | 280 | exit_remove_files: |
270 | very code-efficient in this case. */ | 281 | sysfs_remove_group(&new_client->dev.kobj, &ds1621_group); |
271 | exit_detach: | 282 | exit_detach: |
272 | i2c_detach_client(new_client); | 283 | i2c_detach_client(new_client); |
273 | exit_free: | 284 | exit_free: |
@@ -282,6 +293,7 @@ static int ds1621_detach_client(struct i2c_client *client) | |||
282 | int err; | 293 | int err; |
283 | 294 | ||
284 | hwmon_device_unregister(data->class_dev); | 295 | hwmon_device_unregister(data->class_dev); |
296 | sysfs_remove_group(&client->dev.kobj, &ds1621_group); | ||
285 | 297 | ||
286 | if ((err = i2c_detach_client(client))) | 298 | if ((err = i2c_detach_client(client))) |
287 | return err; | 299 | return err; |