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/max1619.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/max1619.c')
-rw-r--r-- | drivers/hwmon/max1619.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index b4135b5971f4..2f58f651f03a 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/hwmon.h> | 34 | #include <linux/hwmon.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/sysfs.h> | ||
37 | 38 | ||
38 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | 39 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, |
39 | 0x29, 0x2a, 0x2b, | 40 | 0x29, 0x2a, 0x2b, |
@@ -172,6 +173,22 @@ static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, | |||
172 | set_temp_hyst2); | 173 | set_temp_hyst2); |
173 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 174 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
174 | 175 | ||
176 | static struct attribute *max1619_attributes[] = { | ||
177 | &dev_attr_temp1_input.attr, | ||
178 | &dev_attr_temp2_input.attr, | ||
179 | &dev_attr_temp2_min.attr, | ||
180 | &dev_attr_temp2_max.attr, | ||
181 | &dev_attr_temp2_crit.attr, | ||
182 | &dev_attr_temp2_crit_hyst.attr, | ||
183 | |||
184 | &dev_attr_alarms.attr, | ||
185 | NULL | ||
186 | }; | ||
187 | |||
188 | static const struct attribute_group max1619_group = { | ||
189 | .attrs = max1619_attributes, | ||
190 | }; | ||
191 | |||
175 | /* | 192 | /* |
176 | * Real code | 193 | * Real code |
177 | */ | 194 | */ |
@@ -273,22 +290,19 @@ static int max1619_detect(struct i2c_adapter *adapter, int address, int kind) | |||
273 | max1619_init_client(new_client); | 290 | max1619_init_client(new_client); |
274 | 291 | ||
275 | /* Register sysfs hooks */ | 292 | /* Register sysfs hooks */ |
293 | if ((err = sysfs_create_group(&new_client->dev.kobj, &max1619_group))) | ||
294 | goto exit_detach; | ||
295 | |||
276 | data->class_dev = hwmon_device_register(&new_client->dev); | 296 | data->class_dev = hwmon_device_register(&new_client->dev); |
277 | if (IS_ERR(data->class_dev)) { | 297 | if (IS_ERR(data->class_dev)) { |
278 | err = PTR_ERR(data->class_dev); | 298 | err = PTR_ERR(data->class_dev); |
279 | goto exit_detach; | 299 | goto exit_remove_files; |
280 | } | 300 | } |
281 | 301 | ||
282 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
283 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | ||
284 | device_create_file(&new_client->dev, &dev_attr_temp2_min); | ||
285 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | ||
286 | device_create_file(&new_client->dev, &dev_attr_temp2_crit); | ||
287 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst); | ||
288 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
289 | |||
290 | return 0; | 302 | return 0; |
291 | 303 | ||
304 | exit_remove_files: | ||
305 | sysfs_remove_group(&new_client->dev.kobj, &max1619_group); | ||
292 | exit_detach: | 306 | exit_detach: |
293 | i2c_detach_client(new_client); | 307 | i2c_detach_client(new_client); |
294 | exit_free: | 308 | exit_free: |
@@ -318,6 +332,7 @@ static int max1619_detach_client(struct i2c_client *client) | |||
318 | int err; | 332 | int err; |
319 | 333 | ||
320 | hwmon_device_unregister(data->class_dev); | 334 | hwmon_device_unregister(data->class_dev); |
335 | sysfs_remove_group(&client->dev.kobj, &max1619_group); | ||
321 | 336 | ||
322 | if ((err = i2c_detach_client(client))) | 337 | if ((err = i2c_detach_client(client))) |
323 | return err; | 338 | return err; |