]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mfd: vexpress-sysreg: Check the return value of devm_gpiochip_add_data()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 11 Aug 2025 13:36:16 +0000 (15:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 10:00:22 +0000 (12:00 +0200)
commit 1efbee6852f1ff698a9981bd731308dd027189fb upstream.

Commit 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells")
removed the return value check from the call to gpiochip_add_data() (or
rather gpiochip_add() back then and later converted to devres) with no
explanation. This function however can still fail, so check the return
value and bail-out if it does.

Cc: stable@vger.kernel.org
Fixes: 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250811-gpio-mmio-mfd-conv-v1-1-68c5c958cf80@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mfd/vexpress-sysreg.c

index d34d58ce46db2ad0d53b3daeabc9d3763883b39a..5f26ef733fd0d09119b0a72b0e049f6edff20389 100644 (file)
@@ -90,6 +90,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
        struct resource *mem;
        void __iomem *base;
        struct gpio_chip *mmc_gpio_chip;
+       int ret;
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!mem)
@@ -110,7 +111,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
        bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI,
                        NULL, NULL, NULL, NULL, 0);
        mmc_gpio_chip->ngpio = 2;
-       devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL);
+
+       ret = devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL);
+       if (ret)
+               return ret;
 
        return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
                        vexpress_sysreg_cells,