From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux@roeck-us.net
Cc: linux-hwmon@vger.kernel.org
Subject: [bug report] hwmon: (lm83) Convert to use with_info API
Date: Thu, 27 Jan 2022 11:52:18 +0300 [thread overview]
Message-ID: <20220127085218.GE25644@kili> (raw)
Hello Guenter Roeck,
The patch 1c8467e8e8b2: "hwmon: (lm83) Convert to use with_info API"
from Dec 22, 2021, leads to the following Smatch static checker
warning:
drivers/hwmon/lm83.c:337 lm83_is_visible()
warn: signedness bug returning '(-19)'
drivers/hwmon/lm83.c
300 static umode_t lm83_is_visible(const void *_data, enum hwmon_sensor_types type,
301 u32 attr, int channel)
302 {
303 const struct lm83_data *data = _data;
304
305 /*
306 * LM82 only supports a single external channel, modeled as channel 2.
307 */
308 if (data->type == lm82 && (channel == 1 || channel == 3))
309 return 0;
310
311 switch (type) {
312 case hwmon_chip:
313 if (attr == hwmon_chip_alarms)
314 return 0444;
315 break;
316 case hwmon_temp:
317 switch (attr) {
318 case hwmon_temp_input:
319 case hwmon_temp_max_alarm:
320 case hwmon_temp_crit_alarm:
321 return 0444;
322 case hwmon_temp_fault:
323 if (channel)
324 return 0444;
325 break;
326 case hwmon_temp_max:
327 return 0644;
328 case hwmon_temp_crit:
329 if (channel == 2)
330 return 0644;
331 return 0444;
332 default:
333 break;
334 }
335 break;
336 default:
--> 337 return -ENODEV;
return 0;?
338 }
339 return 0;
340 }
regards,
dan carpenter
next reply other threads:[~2022-01-27 8:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 8:52 Dan Carpenter [this message]
2022-01-27 14:10 ` [bug report] hwmon: (lm83) Convert to use with_info 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=20220127085218.GE25644@kili \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox