All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: bcm63138: Use %pe to print pinctrl error instead of %ld
@ 2026-07-13 20:07 Ninad Naik
  2026-07-13 20:15 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ninad Naik @ 2026-07-13 20:07 UTC (permalink / raw)
  To: lee, pavel, william.zhang, anand.gore, kursad.oney,
	florian.fainelli, rafal, linux, krzysztof.kozlowski, tzungbi
  Cc: bcm-kernel-feedback-list, linux-leds, linux-arm-kernel,
	linux-kernel, skhan, me, Ninad Naik

Pass the pinctrl error pointer directly to %pe to print the
symbolic error name.
Detected by Coccinelle. Tested by compiling.

Signed-off-by: Ninad Naik <ninadnaik07@gmail.com>
---
 drivers/leds/blink/leds-bcm63138.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/blink/leds-bcm63138.c b/drivers/leds/blink/leds-bcm63138.c
index 45c0662df933..12b70ee31b9a 100644
--- a/drivers/leds/blink/leds-bcm63138.c
+++ b/drivers/leds/blink/leds-bcm63138.c
@@ -236,8 +236,8 @@ static void bcm63138_leds_create_led(struct bcm63138_leds *leds,
 
 	pinctrl = devm_pinctrl_get_select_default(led->cdev.dev);
 	if (IS_ERR(pinctrl) && PTR_ERR(pinctrl) != -ENODEV) {
-		dev_warn(led->cdev.dev, "Failed to select %pOF pinctrl: %ld\n",
-			 np, PTR_ERR(pinctrl));
+		dev_warn(led->cdev.dev, "Failed to select %pOF pinctrl: %pe\n",
+			 np, pinctrl);
 	}
 
 	bit = BIT(led->pin);
-- 
2.55.0


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

* Re: [PATCH] leds: bcm63138: Use %pe to print pinctrl error instead of %ld
  2026-07-13 20:07 [PATCH] leds: bcm63138: Use %pe to print pinctrl error instead of %ld Ninad Naik
@ 2026-07-13 20:15 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-13 20:15 UTC (permalink / raw)
  To: Ninad Naik; +Cc: linux-leds, lee

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

Pre-existing issues:
- [High] The driver ignores `-EPROBE_DEFER` from `devm_pinctrl_get_select_default()`, failing to properly defer probe when the pinctrl driver is not yet ready.
- [High] Hardware initialization occurs without holding the required spinlock after the LED is exposed to user space, causing a data race on shared hardware registers.
--

--- Patch [1]: [PATCH] leds: bcm63138: Use %pe to print pinctrl error instead of %ld ---
commit 11674fcbe14b4d4811e6f7f83c90fb13ea7bf5ac
Author: Ninad Naik <ninadnaik07@gmail.com>

leds: bcm63138: Use %pe to print pinctrl error instead of %ld

Pass the pinctrl error pointer directly to %pe to print the
symbolic error name. Detected by Coccinelle. Tested by compiling.

> diff --git a/drivers/leds/blink/leds-bcm63138.c b/drivers/leds/blink/leds-bcm63138.c
> index 2cf2761e49145..78a87e1df4d7c 100644
> --- a/drivers/leds/blink/leds-bcm63138.c
> +++ b/drivers/leds/blink/leds-bcm63138.c
> @@ -237,8 +237,8 @@ static void bcm63138_leds_create_led(struct bcm63138_leds *leds,
>  
>  	pinctrl = devm_pinctrl_get_select_default(led->cdev.dev);
>  	if (IS_ERR(pinctrl) && PTR_ERR(pinctrl) != -ENODEV) {
> -		dev_warn(led->cdev.dev, "Failed to select %pOF pinctrl: %ld\n",
> -			 np, PTR_ERR(pinctrl));
> +		dev_warn(led->cdev.dev, "Failed to select %pOF pinctrl: %pe\n",
> +			 np, pinctrl);
>  	}

[Severity: High]
This is a pre-existing issue, but does this code ignore -EPROBE_DEFER from
devm_pinctrl_get_select_default()?

If the pinctrl provider is probed after this LED driver, it would return
-EPROBE_DEFER. Because the driver merely logs a warning and continues instead
of returning the error (e.g. via dev_err_probe), the LED device registers
successfully but remains physically non-functional since its pins are never
multiplexed.

>  
>  	bit = BIT(led->pin);
>  	bcm63138_leds_update_bits(leds, BCM63138_PARALLEL_LED_POLARITY, bit,
>  				  led->active_low ? 0 : bit);
>  	bcm63138_leds_update_bits(leds, BCM63138_HW_LED_EN, bit, 0);
>  	bcm63138_leds_set_flash_rate(leds, led, 0);
>  	bcm63138_leds_enable_led(leds, led, led->cdev.brightness);

[Severity: High]
This is also a pre-existing issue, but is it safe to initialize the hardware
without holding the required spinlock after the LED is exposed to user space?

bcm63138_leds_update_bits() performs a non-atomic read-modify-write on shared
hardware registers. Calling it locklessly here can race with
bcm63138_leds_brightness_set() from another CPU, which locks leds->lock and
performs its own read-modify-write on the same registers, corrupting the
hardware state of previously registered LEDs.

User space can concurrently write to sysfs attributes of this or other LEDs
during this lockless initialization sequence because
devm_led_classdev_register_ext() was already called earlier in this function.

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

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

end of thread, other threads:[~2026-07-13 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 20:07 [PATCH] leds: bcm63138: Use %pe to print pinctrl error instead of %ld Ninad Naik
2026-07-13 20:15 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.