diff mbox series

[v1,1/1] gpio: mlxbf2.c: Add check for bgpio_init failure

Message ID 20211022134438.12083-1-asmaa@nvidia.com
State New
Headers show
Series [v1,1/1] gpio: mlxbf2.c: Add check for bgpio_init failure | expand

Commit Message

Asmaa Mnebhi Oct. 22, 2021, 1:44 p.m. UTC
Add a check if bgpio_init fails.

Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
---
 drivers/gpio/gpio-mlxbf2.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bartosz Golaszewski Oct. 25, 2021, 8:15 a.m. UTC | #1
On Fri, Oct 22, 2021 at 3:44 PM Asmaa Mnebhi <asmaa@nvidia.com> wrote:
>
> Add a check if bgpio_init fails.
>
> Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.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.30.1
>

Queued for fixes, thanks!

Bart
Andy Shevchenko Oct. 25, 2021, 9:31 a.m. UTC | #2
On Mon, Oct 25, 2021 at 11:15 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> On Fri, Oct 22, 2021 at 3:44 PM Asmaa Mnebhi <asmaa@nvidia.com> wrote:

A nit-pick that may be ignored...

> >                         NULL,
> >                         0);
> >
> > +       if (ret) {
> > +               dev_err(dev, "bgpio_init failed\n");
> > +               return ret;
> > +       }

> > +

...can we utilize an empty line before if (ret) { instead?
diff mbox series

Patch

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;