From: Asmaa Mnebhi <asmaa@nvidia.com>
Date: Fri, 22 Oct 2021 09:44:38 -0400
Subject: gpio: mlxbf2.c: Add check for bgpio_init failure
Git-commit: c0eee6fbfa2b3377f1efed10dad539abeb7312aa
Patch-mainline: v5.15
References: jsc#SLE-19248 stable-5.14.19
Add a check if bgpio_init fails.
Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
drivers/gpio/gpio-mlxbf2.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c
index 177d03ef4529..40a052bc6784 100644
--- a/drivers/gpio/gpio-mlxbf2.c
+++ b/drivers/gpio/gpio-mlxbf2.c
@@ -256,6 +256,11 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
NULL,
0);
+ if (ret) {
+ dev_err(dev, "bgpio_init failed\n");
+ return ret;
+ }
+
gc->direction_input = mlxbf2_gpio_direction_input;
gc->direction_output = mlxbf2_gpio_direction_output;
gc->ngpio = npins;
--
2.33.1