Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 12/14] video: backlight: lm3533_bl: Set initial mapping mode from DT
Date: Sat, 06 Jun 2026 05:16:15 +0000	[thread overview]
Message-ID: <20260606051615.863691F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260606045738.21050-13-clamor95@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Sysfs show functions `show_linear` and `show_als_en` incorrectly handle the boolean return value of `regmap_test_bits()`, causing them to return early without formatting output when the bit is set.
--

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

video: backlight: lm3533_bl: Set initial mapping mode from DT
    
Add support to obtain the initial mapping mode from DT instead of leaving
it unconfigured.

> diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
> index 9ad7ea1bbbccb..4f8cde9f290d0 100644
> --- a/drivers/video/backlight/lm3533_bl.c
> +++ b/drivers/video/backlight/lm3533_bl.c

[ ... ]

I noticed a regression in show_linear() and show_als_en() (modified by the
patch 'video: backlight: lm3533_bl: Improve logic of sysfs functions' in
this series) where regmap_test_bits() is called to check if a specific
bit is set:

drivers/video/backlight/lm3533_bl.c:show_als_en() {
	...
	ret = regmap_test_bits(bl->regmap, LM3533_REG_CTRLBANK_AB_BCONF,
			       CTRLBANK_AB_BCONF_ALS(ctrlbank));
	if (ret)
		return ret;

	return scnprintf(buf, PAGE_SIZE, "%d\n", ret);
}

[Severity: High]
Does this code handle the boolean return value of regmap_test_bits()
correctly?

Since regmap_test_bits() returns 1 if the bit is set, this error check
triggers when the bit is set and returns 1 directly instead of formatting
the string.

Returning 1 from a sysfs show function signals to the sysfs core that 1 byte
was written to the buffer. Because the sysfs buffer is zero-initialized prior
to the call, doesn't this return a null byte (\0) to userspace instead of the
expected string "1\n"?

The same pattern appears in show_linear():

drivers/video/backlight/lm3533_bl.c:show_linear() {
	...
	ret = regmap_test_bits(bl->regmap, LM3533_REG_CTRLBANK_AB_BCONF,
			       CTRLBANK_AB_BCONF_MODE(ctrlbank));
	if (ret)
		return ret;

	return scnprintf(buf, PAGE_SIZE, "%x\n", ret);
}

[Severity: High]
Will this also fail to format the output string and return a null byte to
userspace when the feature is enabled?

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

  reply	other threads:[~2026-06-06  5:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-06  4:57 [PATCH v4 00/14] mfd: lm3533: convert to OF bindings, improve support Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 01/14] dt-bindings: leds: Document TI LM3533 LED controller Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 02/14] mfd: lm3533: Remove driver specific regmap wrappers Svyatoslav Ryhel
2026-06-06  6:53   ` Andy Shevchenko
2026-06-06  7:22     ` Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 03/14] mfd: lm3533: Remove extern from shared functions in the header Svyatoslav Ryhel
2026-06-06  6:46   ` Andy Shevchenko
2026-06-06  4:57 ` [PATCH v4 04/14] mfd: lm3533: Pass only regmap and light sensor presence to child devices Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 05/14] iio: light: lm3533-als: Remove redundant pdata helpers Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 06/14] mfd: lm3533-core: " Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 07/14] mfd: lm3533: Switch sysfs_create_group() to device_add_group() Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 08/14] mfd: lm3533: Convert to use OF bindings Svyatoslav Ryhel
2026-06-06  5:14   ` sashiko-bot
2026-06-06  4:57 ` [PATCH v4 09/14] mfd: lm3533: Add support for VIN power supply Svyatoslav Ryhel
2026-06-06  4:57 ` [PATCH v4 10/14] mfd: lm3533: Set DMA mask Svyatoslav Ryhel
2026-06-06  5:08   ` sashiko-bot
2026-06-06  4:57 ` [PATCH v4 11/14] video: backlight: lm3533_bl: Improve logic of sysfs functions Svyatoslav Ryhel
2026-06-06  5:12   ` sashiko-bot
2026-06-06  4:57 ` [PATCH v4 12/14] video: backlight: lm3533_bl: Set initial mapping mode from DT Svyatoslav Ryhel
2026-06-06  5:16   ` sashiko-bot [this message]
2026-06-06  4:57 ` [PATCH v4 13/14] video: backlight: lm3533_bl: Implement backlight_scale property Svyatoslav Ryhel
2026-06-06  5:17   ` sashiko-bot
2026-06-06  4:57 ` [PATCH v4 14/14] video: leds: backlight: lm3533: Support getting LED sources from DT Svyatoslav Ryhel
2026-06-06  5:21   ` 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=20260606051615.863691F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox