aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1025.c
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-09-24 15:15:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:17 -0400
commit681c6f7a6702f208d48b501c8829dbc03a2ca238 (patch)
treeedeba1565c69b4be8e3aeb73df97ccea05fce66c /drivers/hwmon/adm1025.c
parent0501a3816e5b778830fc2157a6d6bb11a965fc2c (diff)
hwmon: Fix unchecked return status, batch 3
hwmon: Fix unchecked return status, batch 3 Fix up some hwmon drivers so that they no longer ignore return status from device_create_file(). Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/adm1025.c')
-rw-r--r--drivers/hwmon/adm1025.c94
1 files changed, 62 insertions, 32 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index a4c859c9fbf8..8c562885b54b 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -315,6 +315,49 @@ static int adm1025_attach_adapter(struct i2c_adapter *adapter)
315 return i2c_probe(adapter, &addr_data, adm1025_detect); 315 return i2c_probe(adapter, &addr_data, adm1025_detect);
316} 316}
317 317
318static struct attribute *adm1025_attributes[] = {
319 &dev_attr_in0_input.attr,
320 &dev_attr_in1_input.attr,
321 &dev_attr_in2_input.attr,
322 &dev_attr_in3_input.attr,
323 &dev_attr_in5_input.attr,
324 &dev_attr_in0_min.attr,
325 &dev_attr_in1_min.attr,
326 &dev_attr_in2_min.attr,
327 &dev_attr_in3_min.attr,
328 &dev_attr_in5_min.attr,
329 &dev_attr_in0_max.attr,
330 &dev_attr_in1_max.attr,
331 &dev_attr_in2_max.attr,
332 &dev_attr_in3_max.attr,
333 &dev_attr_in5_max.attr,
334 &dev_attr_temp1_input.attr,
335 &dev_attr_temp2_input.attr,
336 &dev_attr_temp1_min.attr,
337 &dev_attr_temp2_min.attr,
338 &dev_attr_temp1_max.attr,
339 &dev_attr_temp2_max.attr,
340 &dev_attr_alarms.attr,
341 &dev_attr_cpu0_vid.attr,
342 &dev_attr_vrm.attr,
343 NULL
344};
345
346static const struct attribute_group adm1025_group = {
347 .attrs = adm1025_attributes,
348};
349
350static struct attribute *adm1025_attributes_opt[] = {
351 &dev_attr_in4_input.attr,
352 &dev_attr_in4_min.attr,
353 &dev_attr_in4_max.attr,
354 NULL
355};
356
357static const struct attribute_group adm1025_group_opt = {
358 .attrs = adm1025_attributes_opt,
359};
360
318/* 361/*
319 * The following function does more than just detection. If detection 362 * The following function does more than just detection. If detection
320 * succeeds, it also registers the new chip. 363 * succeeds, it also registers the new chip.
@@ -415,46 +458,31 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind)
415 adm1025_init_client(new_client); 458 adm1025_init_client(new_client);
416 459
417 /* Register sysfs hooks */ 460 /* Register sysfs hooks */
418 data->class_dev = hwmon_device_register(&new_client->dev); 461 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1025_group)))
419 if (IS_ERR(data->class_dev)) {
420 err = PTR_ERR(data->class_dev);
421 goto exit_detach; 462 goto exit_detach;
422 }
423
424 device_create_file(&new_client->dev, &dev_attr_in0_input);
425 device_create_file(&new_client->dev, &dev_attr_in1_input);
426 device_create_file(&new_client->dev, &dev_attr_in2_input);
427 device_create_file(&new_client->dev, &dev_attr_in3_input);
428 device_create_file(&new_client->dev, &dev_attr_in5_input);
429 device_create_file(&new_client->dev, &dev_attr_in0_min);
430 device_create_file(&new_client->dev, &dev_attr_in1_min);
431 device_create_file(&new_client->dev, &dev_attr_in2_min);
432 device_create_file(&new_client->dev, &dev_attr_in3_min);
433 device_create_file(&new_client->dev, &dev_attr_in5_min);
434 device_create_file(&new_client->dev, &dev_attr_in0_max);
435 device_create_file(&new_client->dev, &dev_attr_in1_max);
436 device_create_file(&new_client->dev, &dev_attr_in2_max);
437 device_create_file(&new_client->dev, &dev_attr_in3_max);
438 device_create_file(&new_client->dev, &dev_attr_in5_max);
439 device_create_file(&new_client->dev, &dev_attr_temp1_input);
440 device_create_file(&new_client->dev, &dev_attr_temp2_input);
441 device_create_file(&new_client->dev, &dev_attr_temp1_min);
442 device_create_file(&new_client->dev, &dev_attr_temp2_min);
443 device_create_file(&new_client->dev, &dev_attr_temp1_max);
444 device_create_file(&new_client->dev, &dev_attr_temp2_max);
445 device_create_file(&new_client->dev, &dev_attr_alarms);
446 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
447 device_create_file(&new_client->dev, &dev_attr_vrm);
448 463
449 /* Pin 11 is either in4 (+12V) or VID4 */ 464 /* Pin 11 is either in4 (+12V) or VID4 */
450 if (!(config & 0x20)) { 465 if (!(config & 0x20)) {
451 device_create_file(&new_client->dev, &dev_attr_in4_input); 466 if ((err = device_create_file(&new_client->dev,
452 device_create_file(&new_client->dev, &dev_attr_in4_min); 467 &dev_attr_in4_input))
453 device_create_file(&new_client->dev, &dev_attr_in4_max); 468 || (err = device_create_file(&new_client->dev,
469 &dev_attr_in4_min))
470 || (err = device_create_file(&new_client->dev,
471 &dev_attr_in4_max)))
472 goto exit_remove;
473 }
474
475 data->class_dev = hwmon_device_register(&new_client->dev);
476 if (IS_ERR(data->class_dev)) {
477 err = PTR_ERR(data->class_dev);
478 goto exit_remove;
454 } 479 }
455 480
456 return 0; 481 return 0;
457 482
483exit_remove:
484 sysfs_remove_group(&new_client->dev.kobj, &adm1025_group);
485 sysfs_remove_group(&new_client->dev.kobj, &adm1025_group_opt);
458exit_detach: 486exit_detach:
459 i2c_detach_client(new_client); 487 i2c_detach_client(new_client);
460exit_free: 488exit_free:
@@ -511,6 +539,8 @@ static int adm1025_detach_client(struct i2c_client *client)
511 int err; 539 int err;
512 540
513 hwmon_device_unregister(data->class_dev); 541 hwmon_device_unregister(data->class_dev);
542 sysfs_remove_group(&client->dev.kobj, &adm1025_group);
543 sysfs_remove_group(&client->dev.kobj, &adm1025_group_opt);
514 544
515 if ((err = i2c_detach_client(client))) 545 if ((err = i2c_detach_client(client)))
516 return err; 546 return err;