Re: [bug report] hwmon: Add support for Amphenol ChipCap 2

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

 



Hello Dan,

On 07.02.24 10:51, Dan Carpenter wrote:
> Hello Javier Carrasco,
> 
> The patch 33c41faa98f3: "hwmon: Add support for Amphenol ChipCap 2"
> from Jan 30, 2024 (linux-next), leads to the following Smatch static
> checker warning:
> 
> drivers/hwmon/chipcap2.c:327 cc2_get_reg_val() error: uninitialized symbol 'reg_val'.
> drivers/hwmon/chipcap2.c:695 cc2_request_alarm_irqs() error: uninitialized symbol 'ret'.
> 
> drivers/hwmon/chipcap2.c
>     669 static int cc2_request_alarm_irqs(struct cc2_data *data, struct device *dev)
>     670 {
>     671         int ret;
> 
> Set this to ret = -ENODEV?
> 
>     672 
>     673         data->irq_low = fwnode_irq_get_byname(dev_fwnode(dev), "low");
>     674         if (data->irq_low > 0) {
>     675                 ret = devm_request_threaded_irq(dev, data->irq_low, NULL,
>     676                                                 cc2_low_interrupt,
>     677                                                 IRQF_ONESHOT |
>     678                                                 IRQF_TRIGGER_RISING,
>     679                                                 dev_name(dev), data);
>     680                 if (!ret)
>     681                         data->rh_alarm.low_alarm_visible = true;
>     682         }
>     683 
>     684         data->irq_high = fwnode_irq_get_byname(dev_fwnode(dev), "high");
>     685         if (data->irq_high > 0) {
>     686                 ret = devm_request_threaded_irq(dev, data->irq_high, NULL,
>     687                                                 cc2_high_interrupt,
>     688                                                 IRQF_ONESHOT |
>     689                                                 IRQF_TRIGGER_RISING,
>     690                                                 dev_name(dev), data);
>     691                 if (!ret)
>     692                         data->rh_alarm.high_alarm_visible = true;
>     693         }
>     694 
> --> 695         return ret;
>     696 }
> 
> regards,
> dan carpenter

The ret variable should be initialized to 0 because if no irqs are
defined, the function should not fail i.e. the driver supports that case.
That is probably the reason why I did not notice in my tests.

The reg_val symbol might stay unassigned if the function that assigns
its value fails, and the check of the error return value is missing.


I will fix both issues asap.

Thanks a lot for your feedback and best regards,
Javier Carrasco




[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