* [bug report] hwmon: (lm83) Convert to use with_info API
@ 2022-01-27 8:52 Dan Carpenter
2022-01-27 14:10 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-01-27 8:52 UTC (permalink / raw)
To: linux; +Cc: linux-hwmon
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] hwmon: (lm83) Convert to use with_info API
2022-01-27 8:52 [bug report] hwmon: (lm83) Convert to use with_info API Dan Carpenter
@ 2022-01-27 14:10 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-01-27 14:10 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-hwmon
On 1/27/22 00:52, Dan Carpenter wrote:
> 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;?
>
Oops, yes. Thanks for the note.
Guenter
> 338 }
> 339 return 0;
> 340 }
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-27 14:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 8:52 [bug report] hwmon: (lm83) Convert to use with_info API Dan Carpenter
2022-01-27 14:10 ` Guenter Roeck
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.