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 <[email protected]> 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/[email protected]?part=12
