[PATCH] pinctrl: spacemit: validate pins in pinconf callbacks
Yixun Lan
dlan at kernel.org
Wed Jul 29 03:31:48 PDT 2026
Hi Troy,
On 02:26 Wed 29 Jul , Troy Mitchell wrote:
> Pin 0 is a valid pin ID, but spacemit_pinconf_get() rejects it by
> testing the numeric ID rather than the result of the descriptor lookup.
> It also fails to reject nonzero IDs absent from the SoC pin table before
> computing their register addresses. Check the descriptor and use its pin
> ID for the register lookup.
>
> spacemit_pinconf_group_set() validates only the first group member when
> generating the configuration. If a later member is invalid,
> spacemit_pin_set_config() returns -EINVAL, but the callback ignores it
> and reports success after partially updating the group.
>
> Validate every group member before writing any registers so malformed
> groups fail without being partially applied.
>
> Fixes: a83c29e1d145 ("pinctrl: spacemit: add support for SpacemiT K1 SoC")
> Signed-off-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
The fix looks good to me, thanks
Reviewed-by: Yixun Lan <dlan at kernel.org>
--
Yixun Lan (dlan)
More information about the linux-riscv
mailing list