diff mbox series

gpio: mlxbf3: add an error code check in mlxbf3_gpio_probe

Message ID 20240112042403.3940316-1-suhui@nfschina.com
State Accepted
Commit d460e9c2075164e9b1fa9c4c95f8c05517bd8752
Headers show
Series gpio: mlxbf3: add an error code check in mlxbf3_gpio_probe | expand

Commit Message

Su Hui Jan. 12, 2024, 4:24 a.m. UTC
Clang static checker warning: Value stored to 'ret' is never read.
bgpio_init() returns error code if failed, it's better to add this
check.

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/gpio/gpio-mlxbf3.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bartosz Golaszewski Jan. 15, 2024, 10:12 a.m. UTC | #1
On Fri, Jan 12, 2024 at 5:24 AM Su Hui <suhui@nfschina.com> wrote:
>
> Clang static checker warning: Value stored to 'ret' is never read.
> bgpio_init() returns error code if failed, it's better to add this
> check.
>
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>  drivers/gpio/gpio-mlxbf3.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
> index 7a3e1760fc5b..d5906d419b0a 100644
> --- a/drivers/gpio/gpio-mlxbf3.c
> +++ b/drivers/gpio/gpio-mlxbf3.c
> @@ -215,6 +215,8 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
>                         gs->gpio_clr_io + MLXBF_GPIO_FW_DATA_OUT_CLEAR,
>                         gs->gpio_set_io + MLXBF_GPIO_FW_OUTPUT_ENABLE_SET,
>                         gs->gpio_clr_io + MLXBF_GPIO_FW_OUTPUT_ENABLE_CLEAR, 0);
> +       if (ret)
> +               return dev_err_probe(dev, ret, "%s: bgpio_init() failed", __func__);
>
>         gc->request = gpiochip_generic_request;
>         gc->free = gpiochip_generic_free;
> --
> 2.30.2
>
>

I added the Fixes: tag and applied it.

Bartosz
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
index 7a3e1760fc5b..d5906d419b0a 100644
--- a/drivers/gpio/gpio-mlxbf3.c
+++ b/drivers/gpio/gpio-mlxbf3.c
@@ -215,6 +215,8 @@  static int mlxbf3_gpio_probe(struct platform_device *pdev)
 			gs->gpio_clr_io + MLXBF_GPIO_FW_DATA_OUT_CLEAR,
 			gs->gpio_set_io + MLXBF_GPIO_FW_OUTPUT_ENABLE_SET,
 			gs->gpio_clr_io + MLXBF_GPIO_FW_OUTPUT_ENABLE_CLEAR, 0);
+	if (ret)
+		return dev_err_probe(dev, ret, "%s: bgpio_init() failed", __func__);
 
 	gc->request = gpiochip_generic_request;
 	gc->free = gpiochip_generic_free;