]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
hwmon: (adt7410) handle errors from adt7410_update_device()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 15 Aug 2012 07:49:43 +0000 (10:49 +0300)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 24 Sep 2012 04:08:33 +0000 (21:08 -0700)
Smatch complains that adt7410_update_device() can return error pointers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adt7410.c

index f8606dff3d1ce941112bffac71f71668ec5c7032..030c8d7c33a57b8f03463c4fbb220e5daf81b5d9 100644 (file)
@@ -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