Re: [bug report] hwmon: (lm83) Convert to use with_info API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux