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

* Re: [PATCH] leds: flash: qcom: Fix a signedness bug in qcom_flash_register_led_device()
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2023-03-23 11:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Fenglin Wu, Lee Jones, linux-leds, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Hi!

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

Acked-by: Pavel Machek <pavel@ucw.cz>

But I don't believe we need it in stable.

BR,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: [PATCH] leds: flash: qcom: Fix a signedness bug in qcom_flash_register_led_device()
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2023-03-30 12:46 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Fenglin Wu, linux-leds, kernel-janitors

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 [李琼斯]

^ permalink raw reply	[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