* Re: [PATCH v1 net-next] net: merge redundancy judgement [not found] <1430278559-5609-1-git-send-email-martinbj2008@gmail.com> @ 2015-04-29 4:28 ` David Miller [not found] ` <1430298564-9690-1-git-send-email-martinbj2008@gmail.com> 0 siblings, 1 reply; 2+ messages in thread From: David Miller @ 2015-04-29 4:28 UTC (permalink / raw) To: martinbj2008; +Cc: netdev, linux-kernel From: Martin Zhang <martinbj2008@gmail.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@gmail.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. ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <1430298564-9690-1-git-send-email-martinbj2008@gmail.com>]
* Re: [PATCH V2 net-next] net: merge redundancy judgement [not found] ` <1430298564-9690-1-git-send-email-martinbj2008@gmail.com> @ 2015-04-29 15:59 ` David Miller 0 siblings, 0 replies; 2+ messages in thread From: David Miller @ 2015-04-29 15:59 UTC (permalink / raw) To: martinbj2008; +Cc: netdev, linux-kernel From: Martin Zhang <martinbj2008@gmail.com> Date: Wed, 29 Apr 2015 17:09:24 +0800 > 'if' and 'elseif' do the same operation, > so merge then into a case. > > Signed-off-by: Martin Zhang <martinbj2008@gmail.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 a78540f..2a50411 100644 > --- a/net/ipv4/route.c > +++ b/net/ipv4/route.c > @@ -801,11 +801,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) { This is not indented properly. When an if() condition spans multiple lines, the second and subsequent lines must start precisely at the first column after the openning parenthesis of the first line. You must use the appropriate number of TAB and SPACE characters necessary to do so. You would do well to simply follow the coding style that existed in the lines you are editing, because you are only running into trouble because you are styling things differently from what is happening there already. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-29 15:59 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1430278559-5609-1-git-send-email-martinbj2008@gmail.com> 2015-04-29 4:28 ` [PATCH v1 net-next] net: merge redundancy judgement David Miller [not found] ` <1430298564-9690-1-git-send-email-martinbj2008@gmail.com> 2015-04-29 15:59 ` [PATCH V2 " David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).