Re: [PATCH] pinctrl: mcp23s08: Initialize mcp->dev and mcp->addr before regmap init

From: Linus Walleij

Date: Mon May 11 2026 - 05:40:36 EST


Hi Judith,

thanks for your patch!

On Fri, May 8, 2026 at 11:43 PM Judith Mendez <jm@xxxxxx> wrote:

> Regmap initialization triggers regcache_maple_populate() which attempts
> SPI read to populate cache. SPI read requires mcp->dev and mcp->addr to
> be set, without them, NULL pointer dereference occurs during probe.
>
> Move initialization before mcp23s08_spi_regmap_init() call.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: f9f4fda15e72 ("pinctrl: mcp23s08: init reg_defaults from HW at probe and switch cache type")
> Signed-off-by: Judith Mendez <jm@xxxxxx>
(...)
> + data->mcp[addr]->dev = dev;
> + data->mcp[addr]->addr = 0x40 | (addr << 1);

What does this 0x40 mean here? Can you use a #define to specify
exactly what is going on?

Yours,
Linus Walleij