diff mbox series

rtc: pcf2127: fix error code in pcf2127_enable_ts()

Message ID 55b9c84b-9d21-444f-b91a-cf9316b65833@moroto.mountain
State Accepted
Headers show
Series rtc: pcf2127: fix error code in pcf2127_enable_ts() | expand

Commit Message

Dan Carpenter July 31, 2023, 2:09 p.m. UTC
This error path accidentally returns success.  Return -EINVAL instead.

Fixes: 420cc9e850db ("rtc: pcf2127: add support for multiple TS functions")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
From static analysis.  Not tested.

 drivers/rtc/rtc-pcf2127.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hugo Villeneuve Aug. 1, 2023, 7:20 p.m. UTC | #1
On Mon, 31 Jul 2023 17:09:30 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> This error path accidentally returns success.  Return -EINVAL instead.
> 
> Fixes: 420cc9e850db ("rtc: pcf2127: add support for multiple TS functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> From static analysis.  Not tested.
> 
>  drivers/rtc/rtc-pcf2127.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> index 78141bb06ab0..988cad171174 100644
> --- a/drivers/rtc/rtc-pcf2127.c
> +++ b/drivers/rtc/rtc-pcf2127.c
> @@ -1060,7 +1060,7 @@ static int pcf2127_enable_ts(struct device *dev, int ts_id)
>  	if (pcf2127->cfg->ts[ts_id].gnd_detect_bit == 0) {
>  		dev_err(dev, "%s: tamper detection to GND configuration invalid\n",
>  			__func__);
> -		return ret;
> +		return -EINVAL;
>  	}
>  
>  	/*
> -- 
> 2.39.2
 
Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Hugo Villeneuve Aug. 1, 2023, 7:22 p.m. UTC | #2
On Mon, 31 Jul 2023 17:09:30 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> This error path accidentally returns success.  Return -EINVAL instead.
> 
> Fixes: 420cc9e850db ("rtc: pcf2127: add support for multiple TS functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> From static analysis.  Not tested.
> 
>  drivers/rtc/rtc-pcf2127.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> index 78141bb06ab0..988cad171174 100644
> --- a/drivers/rtc/rtc-pcf2127.c
> +++ b/drivers/rtc/rtc-pcf2127.c
> @@ -1060,7 +1060,7 @@ static int pcf2127_enable_ts(struct device *dev, int ts_id)
>  	if (pcf2127->cfg->ts[ts_id].gnd_detect_bit == 0) {
>  		dev_err(dev, "%s: tamper detection to GND configuration invalid\n",
>  			__func__);
> -		return ret;
> +		return -EINVAL;
>  	}
>  
>  	/*
> -- 
> 2.39.2
 
Reviewed-by: Hugo Villeneuve <hugo@hugovil.com>
Bruno Thomsen Aug. 3, 2023, 11:15 a.m. UTC | #3
Den tirs. 1. aug. 2023 kl. 22.14 skrev Hugo Villeneuve <hugo@hugovil.com>:
>
> On Mon, 31 Jul 2023 17:09:30 +0300
> Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> > This error path accidentally returns success.  Return -EINVAL instead.
> >
> > Fixes: 420cc9e850db ("rtc: pcf2127: add support for multiple TS functions")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > From static analysis.  Not tested.
> >
> >  drivers/rtc/rtc-pcf2127.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> > index 78141bb06ab0..988cad171174 100644
> > --- a/drivers/rtc/rtc-pcf2127.c
> > +++ b/drivers/rtc/rtc-pcf2127.c
> > @@ -1060,7 +1060,7 @@ static int pcf2127_enable_ts(struct device *dev, int ts_id)
> >       if (pcf2127->cfg->ts[ts_id].gnd_detect_bit == 0) {
> >               dev_err(dev, "%s: tamper detection to GND configuration invalid\n",
> >                       __func__);
> > -             return ret;
> > +             return -EINVAL;
> >       }
> >
> >       /*
> > --
> > 2.39.2
>
> Reviewed-by: Hugo Villeneuve <hugo@hugovil.com>

Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Alexandre Belloni Aug. 16, 2023, 10:59 p.m. UTC | #4
On Mon, 31 Jul 2023 17:09:30 +0300, Dan Carpenter wrote:
> This error path accidentally returns success.  Return -EINVAL instead.
> 
> 

Applied, thanks!

[1/1] rtc: pcf2127: fix error code in pcf2127_enable_ts()
      commit: 4e5eb7ef73c4c45e2e621eb51a76565153b63afe

Best regards,
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 78141bb06ab0..988cad171174 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1060,7 +1060,7 @@  static int pcf2127_enable_ts(struct device *dev, int ts_id)
 	if (pcf2127->cfg->ts[ts_id].gnd_detect_bit == 0) {
 		dev_err(dev, "%s: tamper detection to GND configuration invalid\n",
 			__func__);
-		return ret;
+		return -EINVAL;
 	}
 
 	/*