Re: [PATCH v3 2/3] backlight: aw99706: Validate all DT property values consistently
Daniel Thompson <[email protected]>
| Newsgroups | org.kernel.vger.linux-leds,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 04, 2026 at 11:02:54AM +0800, Junjie Cao wrote: > From: Junjie Cao <[email protected]> > > The lookup helpers for dim-mode and ramp-ctl take a shortcut when > lookup_tbl is NULL: they accept any u32 value without range-checking > and return success unconditionally. Out-of-range values get silently > truncated by regmap_update_bits instead of triggering the dev_warn + > default-fallback path that the other properties use. > > Add a field-width check for the NULL-table case so that values > exceeding the register field maximum are rejected the same way a > table-lookup miss is. > > The switching frequency table has a second hole: reserved slots use 0 > as their marker, so "awinic,sw-freq-hz = <0>" matches slot 0 and > programs a reserved encoding. Make the reserved marker U32_MAX and > skip such slots during lookup. > > While here, also switch the error returns to -EINVAL for consistency. > > Fixes: 147b38a5ad06 ("backlight: aw99706: Add support for Awinic AW99706 backlight") > Signed-off-by: Junjie Cao <[email protected]> Reviewed-by: Daniel Thompson (RISCstar) <[email protected]> Daniel.