Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION
@ 2026-07-25  8:13 Arunachalam
  2026-07-25  8:13 ` [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe() Arunachalam
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Arunachalam @ 2026-07-25  8:13 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: Andreas Werner, linux-leds, linux-kernel, Arunachalam

Add the missing MODULE_DESCRIPTION() macro, which is required by
modpost and was missing from this driver.

Signed-off-by: Arunachalam <arun07172003@gmail.com>
---
 drivers/leds/leds-cobalt-raq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-cobalt-raq.c b/drivers/leds/leds-cobalt-raq.c
index 045c239c7..5b5acaa8c 100644
--- a/drivers/leds/leds-cobalt-raq.c
+++ b/drivers/leds/leds-cobalt-raq.c
@@ -101,5 +101,5 @@ static struct platform_driver cobalt_raq_led_driver = {
 		.name	= "cobalt-raq-leds",
 	},
 };
-
+MODULE_DESCRIPTION("LEDs driver for the Cobalt Raq series");
 builtin_platform_driver(cobalt_raq_led_driver);
-- 
2.39.5


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

* [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe()
  2026-07-25  8:13 [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION Arunachalam
@ 2026-07-25  8:13 ` Arunachalam
  2026-07-25  8:21   ` sashiko-bot
  2026-07-25  8:13 ` [PATCH v3 3/4] leds: menf21bmc: " Arunachalam
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Arunachalam @ 2026-07-25  8:13 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: Andreas Werner, linux-leds, linux-kernel, Arunachalam

Replace open-coded dev_err() + return patterns with dev_err_probe(),
which also handles -EPROBE_DEFER correctly.

Signed-off-by: Arunachalam <arun07172003@gmail.com>
---
 drivers/leds/leds-lp8788.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c
index 9b9525ccc..259ac50e8 100644
--- a/drivers/leds/leds-lp8788.c
+++ b/drivers/leds/leds-lp8788.c
@@ -143,16 +143,12 @@ static int lp8788_led_probe(struct platform_device *pdev)
 	mutex_init(&led->lock);
 
 	ret = lp8788_led_init_device(led, led_pdata);
-	if (ret) {
-		dev_err(dev, "led init device err: %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "led init device err\n");
 
 	ret = devm_led_classdev_register(dev, &led->led_dev);
-	if (ret) {
-		dev_err(dev, "led register err: %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "led register err\n");
 
 	return 0;
 }
-- 
2.39.5


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

* [PATCH v3 3/4] leds: menf21bmc: Convert to dev_err_probe()
  2026-07-25  8:13 [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION Arunachalam
  2026-07-25  8:13 ` [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe() Arunachalam
@ 2026-07-25  8:13 ` Arunachalam
  2026-07-25  8:19   ` sashiko-bot
  2026-07-25  8:13 ` [PATCH v3 4/4] leds: 88pm860x: " Arunachalam
  2026-07-25  8:20 ` [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION sashiko-bot
  3 siblings, 1 reply; 8+ messages in thread
From: Arunachalam @ 2026-07-25  8:13 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: Andreas Werner, linux-leds, linux-kernel, Arunachalam

Replace open-coded dev_err() + return pattern with dev_err_probe(),
which also handles -EPROBE_DEFER correctly.

Signed-off-by: Arunachalam <arun07172003@gmail.com>
---
 drivers/leds/leds-menf21bmc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-menf21bmc.c b/drivers/leds/leds-menf21bmc.c
index 6b1b47160..a7e4db487 100644
--- a/drivers/leds/leds-menf21bmc.c
+++ b/drivers/leds/leds-menf21bmc.c
@@ -84,10 +84,8 @@ static int menf21bmc_led_probe(struct platform_device *pdev)
 		leds[i].cdev.brightness_set = menf21bmc_led_set;
 		leds[i].i2c_client = i2c_client;
 		ret = devm_led_classdev_register(&pdev->dev, &leds[i].cdev);
-		if (ret < 0) {
-			dev_err(&pdev->dev, "failed to register LED device\n");
-			return ret;
-		}
+		if (ret < 0)
+			return dev_err_probe(&pdev->dev, ret, "failed to register LED device\n");
 	}
 	dev_info(&pdev->dev, "MEN 140F21P00 BMC LED device enabled\n");
 
-- 
2.39.5


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

* [PATCH v3 4/4] leds: 88pm860x: Convert to dev_err_probe()
  2026-07-25  8:13 [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION Arunachalam
  2026-07-25  8:13 ` [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe() Arunachalam
  2026-07-25  8:13 ` [PATCH v3 3/4] leds: menf21bmc: " Arunachalam
@ 2026-07-25  8:13 ` Arunachalam
  2026-07-25  8:19   ` sashiko-bot
  2026-07-25  8:20 ` [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION sashiko-bot
  3 siblings, 1 reply; 8+ messages in thread
From: Arunachalam @ 2026-07-25  8:13 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: Andreas Werner, linux-leds, linux-kernel, Arunachalam

Replace open-coded dev_err() + return patterns with dev_err_probe(),
which also handles -EPROBE_DEFER correctly.

Signed-off-by: Arunachalam <arun07172003@gmail.com>
---
 drivers/leds/leds-88pm860x.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
index ef5c6c466..65f2af134 100644
--- a/drivers/leds/leds-88pm860x.c
+++ b/drivers/leds/leds-88pm860x.c
@@ -152,16 +152,12 @@ static int pm860x_led_probe(struct platform_device *pdev)
 	if (data == NULL)
 		return -ENOMEM;
 	res = platform_get_resource_byname(pdev, IORESOURCE_REG, "control");
-	if (!res) {
-		dev_err(&pdev->dev, "No REG resource for control\n");
-		return -ENXIO;
-	}
+	if (!res)
+		return dev_err_probe(&pdev->dev, -ENXIO, "No REG resource for control\n");
 	data->reg_control = res->start;
 	res = platform_get_resource_byname(pdev, IORESOURCE_REG, "blink");
-	if (!res) {
-		dev_err(&pdev->dev, "No REG resource for blink\n");
-		return -ENXIO;
-	}
+	if (!res)
+		return dev_err_probe(&pdev->dev, -ENXIO, "No REG resource for blink\n");
 	data->reg_blink = res->start;
 	memset(data->name, 0, MFD_NAME_SIZE);
 	switch (pdev->id) {
@@ -203,10 +199,8 @@ static int pm860x_led_probe(struct platform_device *pdev)
 	mutex_init(&data->lock);
 
 	ret = led_classdev_register(chip->dev, &data->cdev);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "Failed to register LED: %d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret, "Failed to register LED\n");
 	pm860x_led_set(&data->cdev, 0);
 
 	platform_set_drvdata(pdev, data);
-- 
2.39.5


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

* Re: [PATCH v3 4/4] leds: 88pm860x: Convert to dev_err_probe()
  2026-07-25  8:13 ` [PATCH v3 4/4] leds: 88pm860x: " Arunachalam
@ 2026-07-25  8:19   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-07-25  8:19 UTC (permalink / raw)
  To: Arunachalam; +Cc: linux-leds, lee

> Replace open-coded dev_err() + return patterns with dev_err_probe(),
> which also handles -EPROBE_DEFER correctly.
> 
> Signed-off-by: Arunachalam <arun07172003@gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260725081349.8556-1-arun07172003@gmail.com?part=4


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

* Re: [PATCH v3 3/4] leds: menf21bmc: Convert to dev_err_probe()
  2026-07-25  8:13 ` [PATCH v3 3/4] leds: menf21bmc: " Arunachalam
@ 2026-07-25  8:19   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-07-25  8:19 UTC (permalink / raw)
  To: Arunachalam; +Cc: linux-leds, lee

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The `menf21bmc_led_set` function sleeps but is incorrectly assigned to the non-blocking `brightness_set` callback.
--

--- Patch [3]: [PATCH v3 3/4] leds: menf21bmc: Convert to dev_err_probe() ---
commit 47baf6269572a611e45209e561552d7a4bd3af39
Author: Arunachalam <arun07172003@gmail.com>

leds: menf21bmc: Convert to dev_err_probe()
    
Replace open-coded dev_err() + return pattern with dev_err_probe(),
which also handles -EPROBE_DEFER correctly.

> diff --git a/drivers/leds/leds-menf21bmc.c b/drivers/leds/leds-menf21bmc.c
> index 6b1b471606026..a7e4db4879d81 100644
> --- a/drivers/leds/leds-menf21bmc.c
> +++ b/drivers/leds/leds-menf21bmc.c
> @@ -84,10 +84,8 @@ static int menf21bmc_led_probe(struct platform_device *pdev)
>  		leds[i].cdev.brightness_set = menf21bmc_led_set;

[Severity: High]
This is a pre-existing issue, but does assigning this to brightness_set instead
of brightness_set_blocking risk a scheduling while atomic bug?

The menf21bmc_led_set() function acquires a mutex and calls sleeping I2C
functions:

drivers/leds/leds-menf21bmc.c:menf21bmc_led_set() {
    ...
	mutex_lock(&led_lock);
	led_val = i2c_smbus_read_byte_data(led->i2c_client,
					   BMC_CMD_LED_GET_SET);
    ...
}

If an atomic-context trigger like 'timer' or 'heartbeat' is selected for this
LED via sysfs, the LED core could call this non-blocking hook from an atomic
context, which can crash the system.

>  		leds[i].i2c_client = i2c_client;
>  		ret = devm_led_classdev_register(&pdev->dev, &leds[i].cdev);
> -		if (ret < 0) {
> -			dev_err(&pdev->dev, "failed to register LED device\n");
> -			return ret;
> -		}
> +		if (ret < 0)
> +			return dev_err_probe(&pdev->dev, ret, "failed to register LED device\n");
>  	}
>  	dev_info(&pdev->dev, "MEN 140F21P00 BMC LED device enabled\n");
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260725081349.8556-1-arun07172003@gmail.com?part=3

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

* Re: [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION
  2026-07-25  8:13 [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION Arunachalam
                   ` (2 preceding siblings ...)
  2026-07-25  8:13 ` [PATCH v3 4/4] leds: 88pm860x: " Arunachalam
@ 2026-07-25  8:20 ` sashiko-bot
  3 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-07-25  8:20 UTC (permalink / raw)
  To: Arunachalam; +Cc: linux-leds, lee

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Use-After-Unmap and orphaned LED classdevs due to missing .remove callback combined with unmanaged led_classdev_register.
--

--- Patch [1]: [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION ---
commit d2016764a88879b346e156b26cea14e3d81dd4b0
Author: Arunachalam <arun07172003@gmail.com>

leds: cobalt-raq: Add missing MODULE_DESCRIPTION

Add the missing MODULE_DESCRIPTION() macro, which is required by
modpost and was missing from this driver.

> diff --git a/drivers/leds/leds-cobalt-raq.c b/drivers/leds/leds-cobalt-raq.c
> --- a/drivers/leds/leds-cobalt-raq.c
> +++ b/drivers/leds/leds-cobalt-raq.c
> @@ -101,5 +101,5 @@ static struct platform_driver cobalt_raq_led_driver = {
>  		.name	= "cobalt-raq-leds",
>  	},
>  };

[Severity: High]
This isn't a bug introduced by this patch, but is a pre-existing flaw in
the driver.

Does this driver leave orphaned LED classdevs if it is unbound via sysfs?

The LEDs are registered in cobalt_raq_led_probe() using the unmanaged
led_classdev_register() API, but the driver definition here lacks a .remove
callback.

If a privileged user unbinds the driver, the devres cleanup will unmap
led_port. Because the LEDs are not unregistered, they will remain in the
subsystem. Any subsequent access to the sysfs brightness files will execute
raq_power_off_led_set() or raq_web_led_set() and attempt to write to the
unmapped led_port pointer, causing an invalid memory access.

Should this driver be updated to use devm_led_classdev_register() during
probe, or have a .remove callback added to ensure symmetric cleanup?

> -
> +MODULE_DESCRIPTION("LEDs driver for the Cobalt Raq series");
>  builtin_platform_driver(cobalt_raq_led_driver);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260725081349.8556-1-arun07172003@gmail.com?part=1

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

* Re: [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe()
  2026-07-25  8:13 ` [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe() Arunachalam
@ 2026-07-25  8:21   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-07-25  8:21 UTC (permalink / raw)
  To: Arunachalam; +Cc: lee, linux-leds

> Replace open-coded dev_err() + return patterns with dev_err_probe(),
> which also handles -EPROBE_DEFER correctly.
> 
> Signed-off-by: Arunachalam <arun07172003@gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260725081349.8556-1-arun07172003@gmail.com?part=2


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

end of thread, other threads:[~2026-07-25  8:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25  8:13 [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION Arunachalam
2026-07-25  8:13 ` [PATCH v3 2/4] leds: lp8788: Convert to dev_err_probe() Arunachalam
2026-07-25  8:21   ` sashiko-bot
2026-07-25  8:13 ` [PATCH v3 3/4] leds: menf21bmc: " Arunachalam
2026-07-25  8:19   ` sashiko-bot
2026-07-25  8:13 ` [PATCH v3 4/4] leds: 88pm860x: " Arunachalam
2026-07-25  8:19   ` sashiko-bot
2026-07-25  8:20 ` [PATCH v3 1/4] leds: cobalt-raq: Add missing MODULE_DESCRIPTION sashiko-bot

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