* [PATCH] gpio: handle missing regmap
@ 2026-04-07 12:41 Matti Vaittinen
2026-04-08 7:18 ` Bartosz Golaszewski
0 siblings, 1 reply; 3+ messages in thread
From: Matti Vaittinen @ 2026-04-07 12:41 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen, Matti Vaittinen
Cc: Matti Vaittinen, Linus Walleij, Bartosz Golaszewski, linux-gpio,
linux-kernel, Andreas Kemnade
[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]
From: Matti Vaittinen <mazziesaccount@gmail.com>
Currently the probe does not check whether getting the regmap succeeded.
This can cause crash when regmap is used, if it wasn't successfully
obtained. Failing to get the regmap is unlikely, especially since this
driver is expected to be kicked by the MFD driver only after registering
the regmap - but it is still better to handle this gracefully.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: e7eef0bd4075 ("regulator: bd71828-regulator.c: Fix LDON-HEAD mode")
---
As mentioned, this is really not likely to happen. Hence, I am not sure
it needs to be backported or whether to add the Fixes tag or not. OTOH,
fix is very trivial and unlikely to conflict - so maybe it's better to
just backport it.
---
drivers/gpio/gpio-bd72720.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-bd72720.c b/drivers/gpio/gpio-bd72720.c
index 6549dbf4c7ad..d0f936ed80af 100644
--- a/drivers/gpio/gpio-bd72720.c
+++ b/drivers/gpio/gpio-bd72720.c
@@ -256,6 +256,8 @@ static int gpo_bd72720_probe(struct platform_device *pdev)
g->dev = dev;
g->chip.parent = parent;
g->regmap = dev_get_regmap(parent, NULL);
+ if (!g->regmap)
+ return -ENODEV;
return devm_gpiochip_add_data(dev, &g->chip, g);
}
base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
--
2.53.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: handle missing regmap
2026-04-07 12:41 [PATCH] gpio: handle missing regmap Matti Vaittinen
@ 2026-04-08 7:18 ` Bartosz Golaszewski
2026-04-08 7:43 ` Matti Vaittinen
0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2026-04-08 7:18 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Bartosz Golaszewski, Linus Walleij, Bartosz Golaszewski,
linux-gpio, linux-kernel, Andreas Kemnade
On Tue, 07 Apr 2026 15:41:48 +0300, Matti Vaittinen wrote:
> Currently the probe does not check whether getting the regmap succeeded.
> This can cause crash when regmap is used, if it wasn't successfully
> obtained. Failing to get the regmap is unlikely, especially since this
> driver is expected to be kicked by the MFD driver only after registering
> the regmap - but it is still better to handle this gracefully.
>
>
> [...]
The subject should have been: "gpio: bd72720: handle missing regmap".
I fixed it and queued the patch.
[1/1] gpio: handle missing regmap
https://git.kernel.org/brgl/c/828ec7f803f41588a120e6d804297e74a482ab9d
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: handle missing regmap
2026-04-08 7:18 ` Bartosz Golaszewski
@ 2026-04-08 7:43 ` Matti Vaittinen
0 siblings, 0 replies; 3+ messages in thread
From: Matti Vaittinen @ 2026-04-08 7:43 UTC (permalink / raw)
To: Bartosz Golaszewski, Matti Vaittinen
Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
Andreas Kemnade
On 08/04/2026 10:18, Bartosz Golaszewski wrote:
>
> On Tue, 07 Apr 2026 15:41:48 +0300, Matti Vaittinen wrote:
>> Currently the probe does not check whether getting the regmap succeeded.
>> This can cause crash when regmap is used, if it wasn't successfully
>> obtained. Failing to get the regmap is unlikely, especially since this
>> driver is expected to be kicked by the MFD driver only after registering
>> the regmap - but it is still better to handle this gracefully.
>>
>>
>> [...]
>
> The subject should have been: "gpio: bd72720: handle missing regmap".
Indeed!
> I fixed it and queued the patch.
Thanks a bunch :)
Yours,
-- Matti
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-08 7:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 12:41 [PATCH] gpio: handle missing regmap Matti Vaittinen
2026-04-08 7:18 ` Bartosz Golaszewski
2026-04-08 7:43 ` Matti Vaittinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox