Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] mfd: aat2870: Backlight max_brightness incorrectly initialized to 0
--

commit 236a2bd14466123f025d53f0e3094d82e1e098d7
Author: Svyatoslav Ryhel <[email protected]>

mfd: aat2870: Derive brightness steps from max current

The AAT2870 allows only 32 steps of brightness, with this amount defined
by the maximum supported current. Remove the need for max_brightness by
calculating the allowed number of steps from the maximum current.

> diff --git a/drivers/video/backlight/aat2870_bl.c 
> b/drivers/video/backlight/aat2870_bl.c
> index 8b790df1e842b..eb686e315921d 100644
> --- a/drivers/video/backlight/aat2870_bl.c
> +++ b/drivers/video/backlight/aat2870_bl.c
[ ... ]
> @@ -150,10 +139,11 @@ static int aat2870_bl_probe(struct platform_device 
> *pdev)
>       else
>               aat2870_bl->max_current = AAT2870_CURRENT_27_9;
>  
> -     if (pdata->max_brightness > 0)
> -             bd->props.max_brightness = pdata->max_brightness;
> -     else
> -             bd->props.max_brightness = 255;
> +     /*
> +      * The maximum number of brightness steps is determined by the max 
> current.
> +      * The aat2870_current enum maps directly to the allowed brightness 
> steps.
> +      */
> +     bd->props.max_brightness = pdata->max_current;

[Severity: High]
Should this be assigning aat2870_bl->max_current instead of
pdata->max_current?

If pdata->max_current is 0, this bypasses the fallback logic applied just
above and assigns 0 to bd->props.max_brightness. Could this cause a
regression where aat2870_bl_update_status() rejects all valid positive
brightness updates?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to