]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: bd72720: handle missing regmap
authorMatti Vaittinen <mazziesaccount@gmail.com>
Tue, 7 Apr 2026 12:41:48 +0000 (15:41 +0300)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Wed, 8 Apr 2026 07:14:42 +0000 (09:14 +0200)
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")
Link: https://patch.msgid.link/5bfffee380863bcf24f3062e48094c8eb7b1342f.1775565381.git.mazziesaccount@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-bd72720.c

index 6549dbf4c7ad1f7a0e2d44aca87fb74a98f2ec24..d0f936ed80af34cbf240ae3f1da7b70c3f502ceb 100644 (file)
@@ -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);
 }