Linux RTC
 help / color / mirror / Atom feed
* [PATCH] rtc: rtc-max8925: remove redundant check on ret
@ 2017-06-07 15:26 Colin King
  2017-06-08  1:37 ` Andy Shevchenko
  2017-07-30 15:06 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-06-07 15:26 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, linux-rtc
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The check on ret < 0 is redundant as the goto destination is the
next statment.  Remove this redudant check and goto.

Detected by CoverityScan, CID#1268785 ("Identical code for different
branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/rtc/rtc-max8925.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c
index 16d129a0bb3b..67d6fc2d23e6 100644
--- a/drivers/rtc/rtc-max8925.c
+++ b/drivers/rtc/rtc-max8925.c
@@ -234,8 +234,6 @@ static int max8925_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 		ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77);
 	else
 		ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x0);
-	if (ret < 0)
-		goto out;
 out:
 	return ret;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: rtc-max8925: remove redundant check on ret
  2017-06-07 15:26 [PATCH] rtc: rtc-max8925: remove redundant check on ret Colin King
@ 2017-06-08  1:37 ` Andy Shevchenko
  2017-07-30 15:06 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-06-08  1:37 UTC (permalink / raw)
  To: Colin King
  Cc: Alessandro Zummo, Alexandre Belloni, linux-rtc, kernel-janitors,
	linux-kernel@vger.kernel.org

On Wed, Jun 7, 2017 at 6:26 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check on ret < 0 is redundant as the goto destination is the
> next statment.  Remove this redudant check and goto.
>
> Detected by CoverityScan, CID#1268785 ("Identical code for different
> branches")

>                 ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77);
>         else
>                 ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x0);
> -       if (ret < 0)
> -               goto out;
>  out:
>         return ret;

...and label (w/ replacing it by inplace return ret;) ?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: rtc-max8925: remove redundant check on ret
  2017-06-07 15:26 [PATCH] rtc: rtc-max8925: remove redundant check on ret Colin King
  2017-06-08  1:37 ` Andy Shevchenko
@ 2017-07-30 15:06 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2017-07-30 15:06 UTC (permalink / raw)
  To: Colin King; +Cc: Alessandro Zummo, linux-rtc, kernel-janitors, linux-kernel

On 07/06/2017 at 16:26:15 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The check on ret < 0 is redundant as the goto destination is the
> next statment.  Remove this redudant check and goto.
> 
> Detected by CoverityScan, CID#1268785 ("Identical code for different
> branches")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/rtc/rtc-max8925.c | 2 --
>  1 file changed, 2 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-30 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07 15:26 [PATCH] rtc: rtc-max8925: remove redundant check on ret Colin King
2017-06-08  1:37 ` Andy Shevchenko
2017-07-30 15:06 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox