Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH] leds: flash: qcom: Fix a signedness bug in qcom_flash_register_led_device()
@ 2023-03-22  9:05 Dan Carpenter
  2023-03-23 11:50 ` Pavel Machek
  2023-03-30 12:46 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-03-22  9:05 UTC (permalink / raw)
  To: Fenglin Wu; +Cc: Lee Jones, linux-leds, kernel-janitors

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(-)

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");
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-30 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-22  9:05 [PATCH] leds: flash: qcom: Fix a signedness bug in qcom_flash_register_led_device() Dan Carpenter
2023-03-23 11:50 ` Pavel Machek
2023-03-30 12:46 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox