Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniil Demakov" <t3127430@gmail.com>, linux-leds@vger.kernel.org
Cc: linux-gpio@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v3] leds: pca9532: Propagate I2C errors
Date: Sat, 14 Nov 2026 18:31:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-214903@kernel.org> (raw)
In-Reply-To: <20261114181438.22204-1-t3127430@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] leds: pca9532: sleeping mutex acquired in atomic
  pca9532_event() callback
--

commit c7d1a2a939904c415bec23e00e60cb3b774b087c
Author: Daniil Demakov <t3127430@gmail.com>

leds: pca9532: Propagate I2C errors

This commit checks and propagates SMBus read and write errors across LED,
PWM, blink, and GPIO operations while serializing shared state under
update_lock.

> diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
> index c8085427696ff..eb9020e77b46d 100644
> --- a/drivers/leds/leds-pca9532.c
> +++ b/drivers/leds/leds-pca9532.c

[ ... ]

> @@ -255,15 +369,32 @@ static int pca9532_set_blink(struct led_classdev *led_cdev,

[ ... ]

>  static int pca9532_event(struct input_dev *dev, unsigned int type,
> -	unsigned int code, int value)
> +			 unsigned int code, int value)
>  {
>  	struct pca9532_data *data = input_get_drvdata(dev);
>  
> @@ -271,11 +402,15 @@ static int pca9532_event(struct input_dev *dev, unsigned int type,
>  		return -1;
>  
>  	/* XXX: allow different kind of beeps with psc/pwm modifications */
> +	mutex_lock(&data->update_lock);
> +
>  	if (value > 1 && value < 32767)
>  		data->pwm[PCA9532_PWM_ID_1] = 127;
>  	else
>  		data->pwm[PCA9532_PWM_ID_1] = 0;
>  
> +	mutex_unlock(&data->update_lock);
> +
>  	schedule_work(&data->work);
>  
>  	return 0;

[Severity: High]
Does acquiring data->update_lock here sleep in atomic context?

pca9532_event() is the struct input_dev::event callback, which input core
invokes while holding spin_lock_irqsave(&dev->event_lock) (for example via
input_inject_event() -> input_handle_event() -> input_event_dispose()).
Delivering an EV_SND event when a pin is configured as
PCA9532_TYPE_N2100_BEEP will sleep while atomic and can hang or panic the
kernel if data->update_lock is contended.

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

      reply	other threads:[~2026-11-14 18:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 14:19 [PATCH] leds: pca9532: Propagate I2C errors Daniil Demakov
2026-11-14 14:32 ` sashiko-bot
2026-11-14 17:24 ` [PATCH v2] " Daniil Demakov
2026-11-14 17:40   ` sashiko-bot
2026-11-14 18:14   ` [PATCH v3] " Daniil Demakov
2026-11-14 18:31     ` sashiko-bot [this message]

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=sashiko-outbox-214903@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=t3127430@gmail.com \
    /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