diff mbox series

leds: flash: qcom: Fix a signedness bug in qcom_flash_register_led_device()

Message ID 20aeda89-7ed2-4dd8-b707-404a15289fbc@kili.mountain
State New
Headers show
Series leds: flash: qcom: Fix a signedness bug in qcom_flash_register_led_device() | expand

Commit Message

kernel test robot March 22, 2023, 9:05 a.m. UTC
This bug is basically harmless at runtime because of the surrounding lines.
Still the fwnode_property_count_u32() function returns negative error codes
so storing them in an unsigned int will not work.

Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
The patch prefix on this was slightly tricky.  Ideally when people add a
new driver the patch which adds the driver would use the patch prefix
for the driver instead of the subsystem:

Not ideal: [PATCH] leds: Add new driver for QWERTY
    Ideal: [PATCH] leds: qwerty: Add new driver

 drivers/leds/flash/leds-qcom-flash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Lee Jones March 30, 2023, 12:46 p.m. UTC | #1
On Wed, 22 Mar 2023, Dan Carpenter wrote:

> This bug is basically harmless at runtime because of the surrounding lines.
> Still the fwnode_property_count_u32() function returns negative error codes
> so storing them in an unsigned int will not work.
>
> Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> The patch prefix on this was slightly tricky.  Ideally when people add a
> new driver the patch which adds the driver would use the patch prefix
> for the driver instead of the subsystem:
>
> Not ideal: [PATCH] leds: Add new driver for QWERTY
>     Ideal: [PATCH] leds: qwerty: Add new driver

That tends not to happen in my experience and I'm fine with it.

This precedence is usually set by the second commit.

>  drivers/leds/flash/leds-qcom-flash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks

--
Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index 406ed8761c78..4ea33ca88fa8 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -529,8 +529,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 count;
 	int i, rc;
 
 	count = fwnode_property_count_u32(node, "led-sources");