* [lm-sensors] [PATCH v2 1/3] hwmon: (ibmaem) Fix error paths
@ 2011-08-20 12:56 Jean Delvare
2011-08-20 16:33 ` Guenter Roeck
2011-08-23 16:58 ` Darrick J. Wong
0 siblings, 2 replies; 3+ messages in thread
From: Jean Delvare @ 2011-08-20 12:56 UTC (permalink / raw)
To: lm-sensors
From: Jean Delvare <khali@linux-fr.org>
Subject: 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>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
---
No change since v1.
drivers/hwmon/ibmaem.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
--- linux-3.1-rc2.orig/drivers/hwmon/ibmaem.c 2011-08-18 18:57:17.000000000 +0200
+++ linux-3.1-rc2/drivers/hwmon/ibmaem.c 2011-08-18 19:16:12.000000000 +0200
@@ -602,24 +602,26 @@ static int aem_init_aem1_inst(struct aem
platform_set_drvdata(data->pdev, data);
/* Set up IPMI interface */
- if (aem_init_ipmi_data(&data->ipmi, probe->interface,
- probe->bmc_device))
+ res = aem_init_ipmi_data(&data->ipmi, probe->interface,
+ probe->bmc_device);
+ if (res)
goto ipmi_err;
/* Register with hwmon */
data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
-
if (IS_ERR(data->hwmon_dev)) {
dev_err(&data->pdev->dev, "Unable to register hwmon "
"device for IPMI interface %d\n",
probe->interface);
+ res = PTR_ERR(data->hwmon_dev);
goto hwmon_reg_err;
}
data->update = update_aem1_sensors;
/* Find sensors */
- if (aem1_find_sensors(data))
+ res = aem1_find_sensors(data);
+ if (res)
goto sensor_err;
/* Add to our list of AEM devices */
@@ -735,24 +737,26 @@ static int aem_init_aem2_inst(struct aem
platform_set_drvdata(data->pdev, data);
/* Set up IPMI interface */
- if (aem_init_ipmi_data(&data->ipmi, probe->interface,
- probe->bmc_device))
+ res = aem_init_ipmi_data(&data->ipmi, probe->interface,
+ probe->bmc_device);
+ if (res)
goto ipmi_err;
/* Register with hwmon */
data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
-
if (IS_ERR(data->hwmon_dev)) {
dev_err(&data->pdev->dev, "Unable to register hwmon "
"device for IPMI interface %d\n",
probe->interface);
+ res = PTR_ERR(data->hwmon_dev);
goto hwmon_reg_err;
}
data->update = update_aem2_sensors;
/* Find sensors */
- if (aem2_find_sensors(data))
+ res = aem2_find_sensors(data);
+ if (res)
goto sensor_err;
/* Add to our list of AEM devices */
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [lm-sensors] [PATCH v2 1/3] hwmon: (ibmaem) Fix error paths
2011-08-20 12:56 [lm-sensors] [PATCH v2 1/3] hwmon: (ibmaem) Fix error paths Jean Delvare
@ 2011-08-20 16:33 ` Guenter Roeck
2011-08-23 16:58 ` Darrick J. Wong
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2011-08-20 16:33 UTC (permalink / raw)
To: lm-sensors
On Sat, Aug 20, 2011 at 08:56:35AM -0400, Jean Delvare wrote:
> From: Jean Delvare <khali@linux-fr.org>
> Subject: 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>
> Cc: Darrick J. Wong <djwong@us.ibm.com>
> Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [lm-sensors] [PATCH v2 1/3] hwmon: (ibmaem) Fix error paths
2011-08-20 12:56 [lm-sensors] [PATCH v2 1/3] hwmon: (ibmaem) Fix error paths Jean Delvare
2011-08-20 16:33 ` Guenter Roeck
@ 2011-08-23 16:58 ` Darrick J. Wong
1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2011-08-23 16:58 UTC (permalink / raw)
To: lm-sensors
On Sat, Aug 20, 2011 at 09:33:48AM -0700, Guenter Roeck wrote:
> On Sat, Aug 20, 2011 at 08:56:35AM -0400, Jean Delvare wrote:
> > From: Jean Delvare <khali@linux-fr.org>
> > Subject: 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>
> > Cc: Darrick J. Wong <djwong@us.ibm.com>
> > Cc: Guenter Roeck <guenter.roeck@ericsson.com>
>
> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-23 16:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-20 12:56 [lm-sensors] [PATCH v2 1/3] hwmon: (ibmaem) Fix error paths Jean Delvare
2011-08-20 16:33 ` Guenter Roeck
2011-08-23 16:58 ` Darrick J. Wong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.