Re: [PATCH v3 4/5] pinctrl: upboard: fix I2C pinmux-select set CPLD GPIO OUT not function mode
From: Andy Shevchenko
Date: Thu Nov 26 2026 - 15:24:03 EST
On Thu, Nov 26, 2026 at 06:43:20PM +0100, Thomas Richard wrote:
> On 11/26/26 4:31 PM, Andy Shevchenko wrote:
> > On Thu, Nov 26, 2026 at 05:25:37PM +0200, Andy Shevchenko wrote:
> >> On Thu, Nov 26, 2026 at 11:09:47PM +0800, Gary Wang wrote:
> >>> The CPLD I2C pin mode setting through pinmux-select is not correct.
> >>> Should be set UPBOARD_PIN_MODE_FUNCTION on AANT0F04 devices.
> >>>
> >>> Set UPBOARD_PIN_MODE_FUNCTION to 1 to prevent a NULL pointer
> >>> dereference error on .modes[i] for any pin group using this setting.
> >
> > Hmm... bit how the modes[i] can be messed up here? 0 is integer
> > and NULL is void *...
> >
> > Can you provide a compiler warning or traceback of broken kernel with this?
> >
>
> I guess the problem is here [1]. It should triggers a NULL pointer error
> when you select the I2C0/1 functions.
>
> His patch fixes 2 issues:
> - The first one is the wrong pin mode for I2C0/1 functions
> (UPBOARD_PIN_MODE_FUNCTION instead of UPBOARD_PIN_MODE_GPIO_OUT) which
> makes the second one visible.
> - The second one is having UPBOARD_PIN_MODE_FUNCTION=0 because of [1].
Ah, I see, but why not fix the [1] before this patch?
mode = upgroups[group_selector].mode ?: upgroups[group_selector].modes[i];
Shouldn't it be
if (upgroups[group_selector].modes)
mode = upgroups[group_selector].modes[i];
else
mode = upgroups[group_selector].mode;
> [1]
> https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/pinctrl/pinctrl-upboard.c#L713
--
With Best Regards,
Andy Shevchenko