aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm80.c
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-09-24 15:14:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:17 -0400
commit0501a3816e5b778830fc2157a6d6bb11a965fc2c (patch)
tree9424b8b523ea1a9c1522babe2becd77b8c614494 /drivers/hwmon/lm80.c
parentc18beb5b92b090cb424718a4f1771b1a9fad56de (diff)
hwmon: Fix unchecked return status, batch 2
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@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/lm80.c')
-rw-r--r--drivers/hwmon/lm80.c85
1 files changed, 49 insertions, 36 deletions
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index b4ccdfc01203..064516d824ad 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -394,6 +394,48 @@ static int lm80_attach_adapter(struct i2c_adapter *adapter)
394 return i2c_probe(adapter, &addr_data, lm80_detect); 394 return i2c_probe(adapter, &addr_data, lm80_detect);
395} 395}
396 396
397static struct attribute *lm80_attributes[] = {
398 &dev_attr_in0_min.attr,
399 &dev_attr_in1_min.attr,
400 &dev_attr_in2_min.attr,
401 &dev_attr_in3_min.attr,
402 &dev_attr_in4_min.attr,
403 &dev_attr_in5_min.attr,
404 &dev_attr_in6_min.attr,
405 &dev_attr_in0_max.attr,
406 &dev_attr_in1_max.attr,
407 &dev_attr_in2_max.attr,
408 &dev_attr_in3_max.attr,
409 &dev_attr_in4_max.attr,
410 &dev_attr_in5_max.attr,
411 &dev_attr_in6_max.attr,
412 &dev_attr_in0_input.attr,
413 &dev_attr_in1_input.attr,
414 &dev_attr_in2_input.attr,
415 &dev_attr_in3_input.attr,
416 &dev_attr_in4_input.attr,
417 &dev_attr_in5_input.attr,
418 &dev_attr_in6_input.attr,
419 &dev_attr_fan1_min.attr,
420 &dev_attr_fan2_min.attr,
421 &dev_attr_fan1_input.attr,
422 &dev_attr_fan2_input.attr,
423 &dev_attr_fan1_div.attr,
424 &dev_attr_fan2_div.attr,
425 &dev_attr_temp1_input.attr,
426 &dev_attr_temp1_max.attr,
427 &dev_attr_temp1_max_hyst.attr,
428 &dev_attr_temp1_crit.attr,
429 &dev_attr_temp1_crit_hyst.attr,
430 &dev_attr_alarms.attr,
431
432 NULL
433};
434
435static const struct attribute_group lm80_group = {
436 .attrs = lm80_attributes,
437};
438
397static int lm80_detect(struct i2c_adapter *adapter, int address, int kind) 439static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
398{ 440{
399 int i, cur; 441 int i, cur;
@@ -452,48 +494,19 @@ static int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
452 data->fan_min[1] = lm80_read_value(new_client, LM80_REG_FAN_MIN(2)); 494 data->fan_min[1] = lm80_read_value(new_client, LM80_REG_FAN_MIN(2));
453 495
454 /* Register sysfs hooks */ 496 /* Register sysfs hooks */
497 if ((err = sysfs_create_group(&new_client->dev.kobj, &lm80_group)))
498 goto error_detach;
499
455 data->class_dev = hwmon_device_register(&new_client->dev); 500 data->class_dev = hwmon_device_register(&new_client->dev);
456 if (IS_ERR(data->class_dev)) { 501 if (IS_ERR(data->class_dev)) {
457 err = PTR_ERR(data->class_dev); 502 err = PTR_ERR(data->class_dev);
458 goto error_detach; 503 goto error_remove;
459 } 504 }
460 505
461 device_create_file(&new_client->dev, &dev_attr_in0_min);
462 device_create_file(&new_client->dev, &dev_attr_in1_min);
463 device_create_file(&new_client->dev, &dev_attr_in2_min);
464 device_create_file(&new_client->dev, &dev_attr_in3_min);
465 device_create_file(&new_client->dev, &dev_attr_in4_min);
466 device_create_file(&new_client->dev, &dev_attr_in5_min);
467 device_create_file(&new_client->dev, &dev_attr_in6_min);
468 device_create_file(&new_client->dev, &dev_attr_in0_max);
469 device_create_file(&new_client->dev, &dev_attr_in1_max);
470 device_create_file(&new_client->dev, &dev_attr_in2_max);
471 device_create_file(&new_client->dev, &dev_attr_in3_max);
472 device_create_file(&new_client->dev, &dev_attr_in4_max);
473 device_create_file(&new_client->dev, &dev_attr_in5_max);
474 device_create_file(&new_client->dev, &dev_attr_in6_max);
475 device_create_file(&new_client->dev, &dev_attr_in0_input);
476 device_create_file(&new_client->dev, &dev_attr_in1_input);
477 device_create_file(&new_client->dev, &dev_attr_in2_input);
478 device_create_file(&new_client->dev, &dev_attr_in3_input);
479 device_create_file(&new_client->dev, &dev_attr_in4_input);
480 device_create_file(&new_client->dev, &dev_attr_in5_input);
481 device_create_file(&new_client->dev, &dev_attr_in6_input);
482 device_create_file(&new_client->dev, &dev_attr_fan1_min);
483 device_create_file(&new_client->dev, &dev_attr_fan2_min);
484 device_create_file(&new_client->dev, &dev_attr_fan1_input);
485 device_create_file(&new_client->dev, &dev_attr_fan2_input);
486 device_create_file(&new_client->dev, &dev_attr_fan1_div);
487 device_create_file(&new_client->dev, &dev_attr_fan2_div);
488 device_create_file(&new_client->dev, &dev_attr_temp1_input);
489 device_create_file(&new_client->dev, &dev_attr_temp1_max);
490 device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst);
491 device_create_file(&new_client->dev, &dev_attr_temp1_crit);
492 device_create_file(&new_client->dev, &dev_attr_temp1_crit_hyst);
493 device_create_file(&new_client->dev, &dev_attr_alarms);
494
495 return 0; 506 return 0;
496 507
508error_remove:
509 sysfs_remove_group(&new_client->dev.kobj, &lm80_group);
497error_detach: 510error_detach:
498 i2c_detach_client(new_client); 511 i2c_detach_client(new_client);
499error_free: 512error_free:
@@ -508,7 +521,7 @@ static int lm80_detach_client(struct i2c_client *client)
508 int err; 521 int err;
509 522
510 hwmon_device_unregister(data->class_dev); 523 hwmon_device_unregister(data->class_dev);
511 524 sysfs_remove_group(&client->dev.kobj, &lm80_group);
512 if ((err = i2c_detach_client(client))) 525 if ((err = i2c_detach_client(client)))
513 return err; 526 return err;
514 527