[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20150429.002816.509194069032518571.davem@davemloft.net>
Date: Wed, 29 Apr 2015 00:28:16 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: martinbj2008@...il.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 net-next] net: merge redundancy judgement
From: Martin Zhang <martinbj2008@...il.com>
Date: Wed, 29 Apr 2015 11:35:59 +0800
> 'if' and 'elseif' do the same operation,
> so merge then into a case.
>
> Signed-off-by: Martin Zhang <martinbj2008@...il.com>
> ---
> net/ipv4/route.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index ad50643..9b5468c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -802,11 +802,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
> struct dst_entry *ret = dst;
>
> if (rt) {
> - if (dst->obsolete > 0) {
> - ip_rt_put(rt);
> - ret = NULL;
> - } else if ((rt->rt_flags & RTCF_REDIRECTED) ||
> - rt->dst.expires) {
> + if (dst->obsolete > 0 || (rt->rt_flags & RTCF_REDIRECTED)
> + || rt->dst.expires) {
Never begin lines with conditional operators. Rather, end lines with
conditional operators, as it was in the original code.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists