* [patch] hwmon: ADT7410: handle errors from adt7410_update_device()
@ 2012-08-15 7:49 Dan Carpenter
2012-08-15 13:44 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-08-15 7:49 UTC (permalink / raw)
To: kernel-janitors
Smatch complains that adt7410_update_device() can return error pointers.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next.
diff --git a/drivers/hwmon/adt7410.c b/drivers/hwmon/adt7410.c
index f8606df..030c8d7 100644
--- a/drivers/hwmon/adt7410.c
+++ b/drivers/hwmon/adt7410.c
@@ -236,9 +236,14 @@ static ssize_t adt7410_show_t_hyst(struct device *dev,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
- struct adt7410_data *data = adt7410_update_device(dev);
+ struct adt7410_data *data;
int nr = attr->index;
- int hyst = (data->hyst & ADT7410_T_HYST_MASK) * 1000;
+ int hyst;
+
+ data = adt7410_update_device(dev);
+ if (IS_ERR(data))
+ return PTR_ERR(data);
+ hyst = (data->hyst & ADT7410_T_HYST_MASK) * 1000;
/*
* hysteresis is stored as a 4 bit offset in the device, convert it
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] hwmon: ADT7410: handle errors from adt7410_update_device()
2012-08-15 7:49 [patch] hwmon: ADT7410: handle errors from adt7410_update_device() Dan Carpenter
@ 2012-08-15 13:44 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2012-08-15 13:44 UTC (permalink / raw)
To: kernel-janitors
On Wed, Aug 15, 2012 at 10:49:43AM +0300, Dan Carpenter wrote:
> Smatch complains that adt7410_update_device() can return error pointers.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Only needed in linux-next.
>
> diff --git a/drivers/hwmon/adt7410.c b/drivers/hwmon/adt7410.c
> index f8606df..030c8d7 100644
> --- a/drivers/hwmon/adt7410.c
> +++ b/drivers/hwmon/adt7410.c
> @@ -236,9 +236,14 @@ static ssize_t adt7410_show_t_hyst(struct device *dev,
> char *buf)
> {
> struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
> - struct adt7410_data *data = adt7410_update_device(dev);
> + struct adt7410_data *data;
> int nr = attr->index;
> - int hyst = (data->hyst & ADT7410_T_HYST_MASK) * 1000;
> + int hyst;
> +
> + data = adt7410_update_device(dev);
> + if (IS_ERR(data))
> + return PTR_ERR(data);
> + hyst = (data->hyst & ADT7410_T_HYST_MASK) * 1000;
>
Hi Dan,
That should teach me to run smatch on new code :).
Applied, thanks a lot!
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-15 13:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-15 7:49 [patch] hwmon: ADT7410: handle errors from adt7410_update_device() Dan Carpenter
2012-08-15 13:44 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).