public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] hwmon: (core) New hwmon registration API
@ 2017-01-31 10:49 Dan Carpenter
  2017-01-31 12:01 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-01-31 10:49 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon

Hello Guenter Roeck,

This is a semi-automatic email about new static checker warnings.

The patch d560168b5d0f: "hwmon: (core) New hwmon registration API" 
from Aug 26, 2015, leads to the following Smatch complaint:

drivers/hwmon/hwmon.c:624 __hwmon_device_register()
	 error: we previously assumed 'dev' could be null (see line 602)

drivers/hwmon/hwmon.c
   601		hdev->parent = dev;
   602		hdev->of_node = dev ? dev->of_node : NULL;
                                ^^^
I gotta be honest, I have no idea why my scripts say this is a new
warning when it's 2 years old.  This check feels like it could be
deleted and perhaps that's why it didn't complain up to now.  It tries
to ignore extra harmless checks.

   603		hwdev->chip = chip;
   604		dev_set_drvdata(hdev, drvdata);
   605		dev_set_name(hdev, HWMON_ID_FORMAT, id);
   606		err = device_register(hdev);
   607		if (err)
   608			goto free_hwmon;
   609	
   610		if (chip && chip->ops->read &&
   611		    chip->info[0]->type == hwmon_chip &&
   612		    (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) {
   613			const struct hwmon_channel_info **info = chip->info;
   614	
   615			for (i = 1; info[i]; i++) {
   616				if (info[i]->type != hwmon_temp)
   617					continue;
   618	
   619				for (j = 0; info[i]->config[j]; j++) {
   620					if (!chip->ops->is_visible(drvdata, hwmon_temp,
   621								   hwmon_temp_input, j))
   622						continue;
   623					if (info[i]->config[j] & HWMON_T_INPUT)
   624						hwmon_thermal_add_sensor(dev, hwdev, j);
                                                                         ^^^
Dereference.

   625				}
   626			}

regards,
dan carpenter

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

end of thread, other threads:[~2017-01-31 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 10:49 [bug report] hwmon: (core) New hwmon registration API Dan Carpenter
2017-01-31 12:01 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox