[PATCH] pinctrl: spacemit: validate pins in pinconf callbacks

Linus Walleij linusw at kernel.org
Mon Aug 3 00:46:50 PDT 2026


On Wed, Jul 29, 2026 at 11:27 AM Troy Mitchell
<troy.mitchell at linux.spacemit.com> 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>

Patch applied!

Yours,
Linus Walleij



More information about the linux-riscv mailing list