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

Yixun Lan <[email protected]> Wed, 29 Jul 2026 10:31:48 +0000
Newsgroups dev.linux.lists.spacemit,org.infradead.lists.linux-riscv,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
The fix looks good to me, thanks

Reviewed-by: Yixun Lan <[email protected]>

-- 
Yixun Lan (dlan)