diff options
author | Jiapeng Chong <jiapeng.chong@linux.alibaba.com> | 2023-05-31 08:35:59 +0300 |
---|---|---|
committer | Lee Jones <lee@kernel.org> | 2023-06-08 20:12:46 +0300 |
commit | b3f4b679ff427bba8208177ea52cc39128995f62 (patch) | |
tree | 1cca474d71f6a58e80f0610e39ca38e1abcf0d3a /drivers/leds | |
parent | dda968475beb1939be84c7f34636cbc7bdc0eb14 (diff) | |
download | linux-b3f4b679ff427bba8208177ea52cc39128995f62.tar.xz |
leds: flash: leds-qcom-flash: Fix an unsigned comparison which can never be negative
The variable 'count' is defined as unsigned type, so the following if
statement is invalid, we can modify the type of count to int.
if (count <= 0) {
dev_err(dev, "No led-sources specified\n");
return -ENODEV;
}
./drivers/leds/flash/leds-qcom-flash.c:546:5-10: WARNING: Unsigned expression compared with zero: count <= 0.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5344
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230531053559.5702-1-jiapeng.chong@linux.alibaba.com
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/flash/leds-qcom-flash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c index c8d41a3caf38..b089ca1a1901 100644 --- a/drivers/leds/flash/leds-qcom-flash.c +++ b/drivers/leds/flash/leds-qcom-flash.c @@ -538,9 +538,9 @@ static int qcom_flash_register_led_device(struct device *dev, struct led_init_data init_data; struct led_classdev_flash *flash = &led->flash; struct led_flash_setting *brightness, *timeout; - u32 count, current_ua, timeout_us; + u32 current_ua, timeout_us; u32 channels[4]; - int i, rc; + int i, rc, count; count = fwnode_property_count_u32(node, "led-sources"); if (count <= 0) { |