diff mbox series

watchdog: marvell_gti_wdt: Fix error code in probe()

Message ID af326fd7-ac71-43a1-b7de-81779b61d242@moroto.mountain
State New
Headers show
Series watchdog: marvell_gti_wdt: Fix error code in probe() | expand

Commit Message

Dan Carpenter Sept. 7, 2023, 9:53 a.m. UTC
This error path accidentally returns success.  Return -EINVAL instead.

Fixes: ef9e7fe2c890 ("Watchdog: Add marvell GTI watchdog driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/watchdog/marvell_gti_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Sept. 7, 2023, 11:24 a.m. UTC | #1
On 9/7/23 02:53, Dan Carpenter wrote:
> This error path accidentally returns success.  Return -EINVAL instead.
> 
> Fixes: ef9e7fe2c890 ("Watchdog: Add marvell GTI watchdog driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/marvell_gti_wdt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c
> index d7eb8286e11e..1ec1e014ba83 100644
> --- a/drivers/watchdog/marvell_gti_wdt.c
> +++ b/drivers/watchdog/marvell_gti_wdt.c
> @@ -271,7 +271,7 @@ static int gti_wdt_probe(struct platform_device *pdev)
>   				   &wdt_idx);
>   	if (!err) {
>   		if (wdt_idx >= priv->data->gti_num_timers)
> -			return dev_err_probe(&pdev->dev, err,
> +			return dev_err_probe(&pdev->dev, -EINVAL,
>   				"GTI wdog timer index not valid");
>   
>   		priv->wdt_timer_idx = wdt_idx;
Bharat Bhushan Sept. 8, 2023, 6:45 a.m. UTC | #2
> -----Original Message-----
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Thursday, September 7, 2023 4:55 PM
> To: Dan Carpenter <dan.carpenter@linaro.org>; Bharat Bhushan
> <bbhushan2@marvell.com>
> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>; linux-
> watchdog@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [EXT] Re: [PATCH] watchdog: marvell_gti_wdt: Fix error code in probe()
> 
> External Email
> 
> ----------------------------------------------------------------------
> On 9/7/23 02:53, Dan Carpenter wrote:
> > This error path accidentally returns success.  Return -EINVAL instead.
> >
> > Fixes: ef9e7fe2c890 ("Watchdog: Add marvell GTI watchdog driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Reviewed-by: Bharat Bhushan <bbhushan2@marvell.com>

Thanks
-Bharat

> 
> > ---
> >   drivers/watchdog/marvell_gti_wdt.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/watchdog/marvell_gti_wdt.c
> b/drivers/watchdog/marvell_gti_wdt.c
> > index d7eb8286e11e..1ec1e014ba83 100644
> > --- a/drivers/watchdog/marvell_gti_wdt.c
> > +++ b/drivers/watchdog/marvell_gti_wdt.c
> > @@ -271,7 +271,7 @@ static int gti_wdt_probe(struct platform_device *pdev)
> >   				   &wdt_idx);
> >   	if (!err) {
> >   		if (wdt_idx >= priv->data->gti_num_timers)
> > -			return dev_err_probe(&pdev->dev, err,
> > +			return dev_err_probe(&pdev->dev, -EINVAL,
> >   				"GTI wdog timer index not valid");
> >
> >   		priv->wdt_timer_idx = wdt_idx;
diff mbox series

Patch

diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c
index d7eb8286e11e..1ec1e014ba83 100644
--- a/drivers/watchdog/marvell_gti_wdt.c
+++ b/drivers/watchdog/marvell_gti_wdt.c
@@ -271,7 +271,7 @@  static int gti_wdt_probe(struct platform_device *pdev)
 				   &wdt_idx);
 	if (!err) {
 		if (wdt_idx >= priv->data->gti_num_timers)
-			return dev_err_probe(&pdev->dev, err,
+			return dev_err_probe(&pdev->dev, -EINVAL,
 				"GTI wdog timer index not valid");
 
 		priv->wdt_timer_idx = wdt_idx;