Colin King
2017-Feb-07 10:56 UTC
[Bridge] [PATCH][net-next] net: bridge: remove redundant check to see if err is set
From: Colin Ian King <colin.king at canonical.com> The error check on err is redundant as it is being checked previously each time it has been updated. Remove this redundant check. Detected with CoverityScan, CID#140030("Logically dead code") Signed-off-by: Colin Ian King <colin.king at canonical.com> --- net/bridge/br_netlink.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index fc5d885..cdc4e2a 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c @@ -612,9 +612,6 @@ static int br_afspec(struct net_bridge *br, return err; break; } - - if (err) - return err; } return err; -- 2.10.2
Nikolay Aleksandrov
2017-Feb-07 11:30 UTC
[Bridge] [PATCH][net-next] net: bridge: remove redundant check to see if err is set
On 07/02/17 11:56, Colin King wrote:> From: Colin Ian King <colin.king at canonical.com> > > The error check on err is redundant as it is being checked > previously each time it has been updated. Remove this redundant > check. > > Detected with CoverityScan, CID#140030("Logically dead code") > > Signed-off-by: Colin Ian King <colin.king at canonical.com> > --- > net/bridge/br_netlink.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c > index fc5d885..cdc4e2a 100644 > --- a/net/bridge/br_netlink.c > +++ b/net/bridge/br_netlink.c > @@ -612,9 +612,6 @@ static int br_afspec(struct net_bridge *br, > return err; > break; > } > - > - if (err) > - return err; > } > > return err; >Actually that code can be reduced further, I'll follow up with a patch later. Reviewed-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com>
David Miller
2017-Feb-07 19:05 UTC
[Bridge] [PATCH][net-next] net: bridge: remove redundant check to see if err is set
From: Colin King <colin.king at canonical.com> Date: Tue, 7 Feb 2017 10:56:38 +0000> From: Colin Ian King <colin.king at canonical.com> > > The error check on err is redundant as it is being checked > previously each time it has been updated. Remove this redundant > check. > > Detected with CoverityScan, CID#140030("Logically dead code") > > Signed-off-by: Colin Ian King <colin.king at canonical.com>Applied.