aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-11-04 07:00:46 -0400
committerJean Delvare <khali@endymion.delvare>2011-11-04 07:00:46 -0400
commit547a1c99d0052c8bee0a8fe4091e6a9094c3cde3 (patch)
tree59b992509ab6c0a24df9f0391e1f974ff6269c6f /drivers/hwmon
parent24d6e2a89a1ff0a035f163a83a2812a3192083b6 (diff)
hwmon: (ibmaem) Fix error paths
I am under the impression that error paths in functions aem_init_aem1_inst() and aem_init_aem2_inst() are incorrect. In several cases, the function returns 0 on error, which I suspect is not intended. Fix this by properly tracking error codes. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Darrick J. Wong <djwong@us.ibm.com> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ibmaem.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
index 783d0c17b762..aba6b59dc3a5 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -570,24 +570,26 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
570 platform_set_drvdata(data->pdev, data); 570 platform_set_drvdata(data->pdev, data);
571 571
572 /* Set up IPMI interface */ 572 /* Set up IPMI interface */
573 if (aem_init_ipmi_data(&data->ipmi, probe->interface, 573 res = aem_init_ipmi_data(&data->ipmi, probe->interface,
574 probe->bmc_device)) 574 probe->bmc_device);
575 if (res)
575 goto ipmi_err; 576 goto ipmi_err;
576 577
577 /* Register with hwmon */ 578 /* Register with hwmon */
578 data->hwmon_dev = hwmon_device_register(&data->pdev->dev); 579 data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
579
580 if (IS_ERR(data->hwmon_dev)) { 580 if (IS_ERR(data->hwmon_dev)) {
581 dev_err(&data->pdev->dev, "Unable to register hwmon " 581 dev_err(&data->pdev->dev, "Unable to register hwmon "
582 "device for IPMI interface %d\n", 582 "device for IPMI interface %d\n",
583 probe->interface); 583 probe->interface);
584 res = PTR_ERR(data->hwmon_dev);
584 goto hwmon_reg_err; 585 goto hwmon_reg_err;
585 } 586 }
586 587
587 data->update = update_aem1_sensors; 588 data->update = update_aem1_sensors;
588 589
589 /* Find sensors */ 590 /* Find sensors */
590 if (aem1_find_sensors(data)) 591 res = aem1_find_sensors(data);
592 if (res)
591 goto sensor_err; 593 goto sensor_err;
592 594
593 /* Add to our list of AEM devices */ 595 /* Add to our list of AEM devices */
@@ -704,24 +706,26 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
704 platform_set_drvdata(data->pdev, data); 706 platform_set_drvdata(data->pdev, data);
705 707
706 /* Set up IPMI interface */ 708 /* Set up IPMI interface */
707 if (aem_init_ipmi_data(&data->ipmi, probe->interface, 709 res = aem_init_ipmi_data(&data->ipmi, probe->interface,
708 probe->bmc_device)) 710 probe->bmc_device);
711 if (res)
709 goto ipmi_err; 712 goto ipmi_err;
710 713
711 /* Register with hwmon */ 714 /* Register with hwmon */
712 data->hwmon_dev = hwmon_device_register(&data->pdev->dev); 715 data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
713
714 if (IS_ERR(data->hwmon_dev)) { 716 if (IS_ERR(data->hwmon_dev)) {
715 dev_err(&data->pdev->dev, "Unable to register hwmon " 717 dev_err(&data->pdev->dev, "Unable to register hwmon "
716 "device for IPMI interface %d\n", 718 "device for IPMI interface %d\n",
717 probe->interface); 719 probe->interface);
720 res = PTR_ERR(data->hwmon_dev);
718 goto hwmon_reg_err; 721 goto hwmon_reg_err;
719 } 722 }
720 723
721 data->update = update_aem2_sensors; 724 data->update = update_aem2_sensors;
722 725
723 /* Find sensors */ 726 /* Find sensors */
724 if (aem2_find_sensors(data)) 727 res = aem2_find_sensors(data);
728 if (res)
725 goto sensor_err; 729 goto sensor_err;
726 730
727 /* Add to our list of AEM devices */ 731 /* Add to our list of AEM devices */