Skip to content

Commit d7c7b38

Browse files
Bartosz Golaszewskigregkh
authored andcommitted
mfd: vexpress-sysreg: Check the return value of devm_gpiochip_add_data()
commit 1efbee6 upstream. Commit 974cc7b ("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: 974cc7b ("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>
1 parent 8a2ca33 commit d7c7b38

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/mfd/vexpress-sysreg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
9999
struct resource *mem;
100100
void __iomem *base;
101101
struct gpio_chip *mmc_gpio_chip;
102+
int ret;
102103

103104
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
104105
if (!mem)
@@ -119,7 +120,10 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
119120
bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI,
120121
NULL, NULL, NULL, NULL, 0);
121122
mmc_gpio_chip->ngpio = 2;
122-
devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL);
123+
124+
ret = devm_gpiochip_add_data(&pdev->dev, mmc_gpio_chip, NULL);
125+
if (ret)
126+
return ret;
123127

124128
return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
125129
vexpress_sysreg_cells,

0 commit comments

Comments
 (0)