All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 5/6] video: backlight: lm3533_bl: Set initial mapping mode from DT
Date: Thu, 28 May 2026 16:00:44 +0000	[thread overview]
Message-ID: <20260528160045.592AE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260528135123.103745-6-clamor95@gmail.com>

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

Pre-existing issues:
- [High] The backlight device is exposed to userspace before its hardware initialization is complete.
--

commit 106cefce156b039f4639eecee3b1a98c82987da6
Author: Svyatoslav Ryhel <clamor95@gmail.com>

video: backlight: lm3533_bl: Set initial mapping mode from DT

This commit adds support to obtain the initial mapping mode from DT instead
of leaving it unconfigured. It also updates the linear sysfs code.

> diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
> index 42da652df58d9..c03d0d1667e42 100644
> --- a/drivers/video/backlight/lm3533_bl.c
> +++ b/drivers/video/backlight/lm3533_bl.c

[ ... ]

> @@ -317,14 +318,6 @@ static int lm3533_bl_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, bl);
>  
> -	ret = sysfs_create_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "failed to create sysfs attributes\n");
> -		return ret;
> -	}
> -
> -	backlight_update_status(bd);
> -
>  	device_property_read_u32(&pdev->dev, "led-max-microamp",
>  				 &bl->max_current);
>  	bl->max_current = clamp(bl->max_current, LM3533_LED_MAX_CURRENT_MIN,
> @@ -333,9 +326,20 @@ static int lm3533_bl_probe(struct platform_device *pdev)
>  	bl->pwm = 0;
>  	device_property_read_u32(&pdev->dev, "ti,pwm-config-mask", &bl->pwm);
>  
> +	bl->linear = device_property_read_bool(&pdev->dev,
> +					       "ti,linear-mapping-mode");
> +
>  	ret = lm3533_bl_setup(bl);

[Severity: High]
This is a pre-existing issue, but I noticed a potential race condition here
with devm_backlight_device_register() being called earlier in this function.

When devm_backlight_device_register() is called, it creates the device in
sysfs, exposes standard attributes like brightness, and immediately fires a
KOBJ_ADD uevent.

Could a userspace daemon like systemd-backlight react to this uevent and
write a saved brightness value concurrently with the rest of this probe
function?

If that happens, it would trigger lm3533_bl_ops.update_status, which calls
lm3533_ctrlbank_set_brightness() to configure the hardware to drive the LEDs.

Because the driver has not yet read device tree limits like led-max-microamp
and applied them via lm3533_bl_setup() and lm3533_ctrlbank_set_max_current(),
could driving the LEDs before configuring the hardware's maximum safe current
limit result in physical hardware damage?

>  	if (ret)
> -		goto err_sysfs_remove;
> +		return ret;
> +
> +	ret = sysfs_create_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "failed to create sysfs attributes\n");
> +		return ret;
> +	}
> +
> +	backlight_update_status(bd);

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

  reply	other threads:[~2026-05-28 16:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 13:51 [PATCH v2 0/6] mfd: lm3533: convert to OF bindings, improve support Svyatoslav Ryhel
2026-05-28 13:51 ` [PATCH v2 1/6] dt-bindings: leds: Document TI LM3533 LED controller Svyatoslav Ryhel
2026-05-28 14:08   ` sashiko-bot
2026-05-28 14:54   ` Jonathan Cameron
2026-05-29  9:51   ` Daniel Thompson
2026-05-29 10:07     ` Svyatoslav Ryhel
2026-05-29 10:46       ` Daniel Thompson
2026-05-29 10:56         ` Svyatoslav Ryhel
2026-05-28 13:51 ` [PATCH v2 2/6] mfd: lm3533: Convert to use OF bindings Svyatoslav Ryhel
2026-05-28 14:37   ` sashiko-bot
2026-05-28 14:50   ` Jonathan Cameron
2026-05-28 15:03     ` Svyatoslav Ryhel
2026-05-29  9:08       ` Jonathan Cameron
2026-05-29  9:39         ` Svyatoslav Ryhel
2026-05-29 10:48           ` Jonathan Cameron
2026-05-29 11:02             ` Svyatoslav Ryhel
2026-05-29 13:10               ` Jonathan Cameron
2026-05-29 11:00   ` Daniel Thompson
2026-05-29 11:06     ` Svyatoslav Ryhel
2026-05-28 13:51 ` [PATCH v2 3/6] mfd: lm3533: Add support for VIN power supply Svyatoslav Ryhel
2026-05-28 14:56   ` sashiko-bot
2026-05-28 13:51 ` [PATCH v2 4/6] mfd: lm3533: Set DMA mask Svyatoslav Ryhel
2026-05-28 15:28   ` sashiko-bot
2026-05-28 13:51 ` [PATCH v2 5/6] video: backlight: lm3533_bl: Set initial mapping mode from DT Svyatoslav Ryhel
2026-05-28 16:00   ` sashiko-bot [this message]
2026-05-29 11:10   ` Daniel Thompson
2026-05-29 11:17     ` Svyatoslav Ryhel
2026-05-29 11:40       ` Daniel Thompson
2026-05-28 13:51 ` [PATCH v2 6/6] video: leds: backlight: lm3533: Support getting LED sources " Svyatoslav Ryhel
2026-05-28 16:33   ` sashiko-bot

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=20260528160045.592AE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@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 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.