Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Arunachalam <arun07172003@gmail.com>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v3 3/4] leds: menf21bmc: Convert to dev_err_probe()
Date: Sat, 25 Jul 2026 08:19:37 +0000	[thread overview]
Message-ID: <20260725081938.422B11F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260725081349.8556-3-arun07172003@gmail.com>

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

  reply	other threads:[~2026-07-25  8:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-07-25 17:51     ` [PATCH 1/2] leds: menf21bmc: Use brightness_set_blocking instead of brightness_set Arunachalam
2026-07-25  8:13 ` [PATCH v3 4/4] leds: 88pm860x: Convert to dev_err_probe() 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
2026-07-25 17:52   ` [PATCH 2/2] leds: cobalt-raq: Use devm_led_classdev_register() to fix use-after-unmap Arunachalam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260725081938.422B11F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arun07172003@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox