From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux@roeck-us.net
Cc: linux-hwmon@vger.kernel.org
Subject: [bug report] hwmon: (core) New hwmon registration API
Date: Tue, 31 Jan 2017 13:49:18 +0300 [thread overview]
Message-ID: <20170131104918.GA10541@mwanda> (raw)
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
next reply other threads:[~2017-01-31 10:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 10:49 Dan Carpenter [this message]
2017-01-31 12:01 ` [bug report] hwmon: (core) New hwmon registration API Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170131104918.GA10541@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.