linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] hwmon: (it87) Test for error in it87_update_device
@ 2023-04-21 10:45 Dan Carpenter
  2023-04-21 14:28 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2023-04-21 10:45 UTC (permalink / raw)
  To: frank; +Cc: linux-hwmon

Hello Frank Crawford,

The patch 27302e7a46f5: "hwmon: (it87) Test for error in
it87_update_device" from Apr 16, 2023, leads to the following Smatch
static checker warning:

	drivers/hwmon/it87.c:1147 show_temp_type()
	error: 'data' dereferencing possible ERR_PTR()

drivers/hwmon/it87.c
    1141 static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr,
    1142                               char *buf)
    1143 {
    1144         struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
    1145         int nr = sensor_attr->index;
    1146         struct it87_data *data = it87_update_device(dev);
--> 1147         u8 reg = data->sensor;            /* In case value is updated while used */
                          ^^^^^^^^^^^^
    1148         u8 extra = data->extra;
                            ^^^^^^^^^^^

    1149 
    1150         if (IS_ERR(data))

This new check happens too late.

    1151                 return PTR_ERR(data);
    1152 

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-22  1:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 10:45 [bug report] hwmon: (it87) Test for error in it87_update_device Dan Carpenter
2023-04-21 14:28 ` Guenter Roeck
2023-04-22  1:55   ` Frank Crawford

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).