From: Judith Mendez <jm@ti.com>
To: Linus Walleij <linusw@kernel.org>
Cc: Maksim Kiselev <bigunclemax@gmail.com>,
<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: mcp23s08: Initialize mcp->dev and mcp->addr before regmap init
Date: Wed, 13 May 2026 16:52:44 -0500 [thread overview]
Message-ID: <55825588-7e92-4d2d-b4f9-869f5fa80d31@ti.com> (raw)
In-Reply-To: <CAD++jLmS2ObzMQ+h2A825dcv5nwfrTi9ozcFbBUNiw_qq=W+eA@mail.gmail.com>
Hi Linus,
On 5/11/26 4:13 AM, Linus Walleij wrote:
> Hi Judith,
>
> thanks for your patch!
>
> On Fri, May 8, 2026 at 11:43 PM Judith Mendez <jm@ti.com> 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@vger.kernel.org
>> Fixes: f9f4fda15e72 ("pinctrl: mcp23s08: init reg_defaults from HW at probe and switch cache type")
>> Signed-off-by: Judith Mendez <jm@ti.com>
> (...)
>> + 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?
Really I am just moving the two definitions up in probe, they will get
re-written later. It is the base WRITE opcode for SPI chips.
I don't know much on this driver/HW, beyond the things I had to debug
when enabling this driver on BeagleBadge with a on board MCP23S18 chip.
So please scrutinize my changes.
Will add a constant definition and respin.
BTW I found another bug so will append to this series.
Thanks for reviewing.
~ Judith
prev parent reply other threads:[~2026-05-13 21:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 21:43 [PATCH] pinctrl: mcp23s08: Initialize mcp->dev and mcp->addr before regmap init Judith Mendez
2026-05-11 9:13 ` Linus Walleij
2026-05-13 21:52 ` Judith Mendez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55825588-7e92-4d2d-b4f9-869f5fa80d31@ti.com \
--to=jm@ti.com \
--cc=bigunclemax@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox