Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1660646

Re: [PATCH] rtc: rtc-max8925: remove redundant check on ret

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] rtc: rtc-max8925: remove redundant check on ret
Date 2017-06-08 03:40 +0200
Message-ID <tPUAx-61U-1@gated-at.bofh.it> (permalink)
References <tPL4e-8ou-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] rtc: rtc-max8925: remove redundant check on ret Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 03:40 +0200

csiph-web