diff options
author | Ian Morris <ipm@chirality.org.uk> | 2015-03-29 09:00:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 13:51:54 -0400 |
commit | 63159f29be1df7f93563a8a0f78c5e65fc844ed6 (patch) | |
tree | aba1b4275abb0692728b97851f2d52e07d3f6e94 /net/ipv6/ip6_output.c | |
parent | bc48878c06028f297e4fdf75be7dda88de050430 (diff) |
ipv6: coding style: comparison for equality with NULL
The ipv6 code uses a mixture of coding styles. In some instances check for NULL
pointer is done as x == NULL and sometimes as !x. !x is preferred according to
checkpatch and this patch makes the code consistent by adopting the latter
form.
No changes detected by objdiff.
Signed-off-by: Ian Morris <ipm@chirality.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r-- | net/ipv6/ip6_output.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index b06ad00048d5..8b6d40223090 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -177,7 +177,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, | |||
177 | 177 | ||
178 | if (skb_headroom(skb) < head_room) { | 178 | if (skb_headroom(skb) < head_room) { |
179 | struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); | 179 | struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); |
180 | if (skb2 == NULL) { | 180 | if (!skb2) { |
181 | IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), | 181 | IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), |
182 | IPSTATS_MIB_OUTDISCARDS); | 182 | IPSTATS_MIB_OUTDISCARDS); |
183 | kfree_skb(skb); | 183 | kfree_skb(skb); |
@@ -823,7 +823,7 @@ static inline int ip6_rt_check(const struct rt6key *rt_key, | |||
823 | const struct in6_addr *addr_cache) | 823 | const struct in6_addr *addr_cache) |
824 | { | 824 | { |
825 | return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) && | 825 | return (rt_key->plen != 128 || !ipv6_addr_equal(fl_addr, &rt_key->addr)) && |
826 | (addr_cache == NULL || !ipv6_addr_equal(fl_addr, addr_cache)); | 826 | (!addr_cache || !ipv6_addr_equal(fl_addr, addr_cache)); |
827 | } | 827 | } |
828 | 828 | ||
829 | static struct dst_entry *ip6_sk_dst_check(struct sock *sk, | 829 | static struct dst_entry *ip6_sk_dst_check(struct sock *sk, |
@@ -882,7 +882,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
882 | #endif | 882 | #endif |
883 | int err; | 883 | int err; |
884 | 884 | ||
885 | if (*dst == NULL) | 885 | if (!*dst) |
886 | *dst = ip6_route_output(net, sk, fl6); | 886 | *dst = ip6_route_output(net, sk, fl6); |
887 | 887 | ||
888 | err = (*dst)->error; | 888 | err = (*dst)->error; |
@@ -1045,11 +1045,11 @@ static inline int ip6_ufo_append_data(struct sock *sk, | |||
1045 | * udp datagram | 1045 | * udp datagram |
1046 | */ | 1046 | */ |
1047 | skb = skb_peek_tail(queue); | 1047 | skb = skb_peek_tail(queue); |
1048 | if (skb == NULL) { | 1048 | if (!skb) { |
1049 | skb = sock_alloc_send_skb(sk, | 1049 | skb = sock_alloc_send_skb(sk, |
1050 | hh_len + fragheaderlen + transhdrlen + 20, | 1050 | hh_len + fragheaderlen + transhdrlen + 20, |
1051 | (flags & MSG_DONTWAIT), &err); | 1051 | (flags & MSG_DONTWAIT), &err); |
1052 | if (skb == NULL) | 1052 | if (!skb) |
1053 | return err; | 1053 | return err; |
1054 | 1054 | ||
1055 | /* reserve space for Hardware header */ | 1055 | /* reserve space for Hardware header */ |
@@ -1107,7 +1107,7 @@ static void ip6_append_data_mtu(unsigned int *mtu, | |||
1107 | unsigned int orig_mtu) | 1107 | unsigned int orig_mtu) |
1108 | { | 1108 | { |
1109 | if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { | 1109 | if (!(rt->dst.flags & DST_XFRM_TUNNEL)) { |
1110 | if (skb == NULL) { | 1110 | if (!skb) { |
1111 | /* first fragment, reserve header_len */ | 1111 | /* first fragment, reserve header_len */ |
1112 | *mtu = orig_mtu - rt->dst.header_len; | 1112 | *mtu = orig_mtu - rt->dst.header_len; |
1113 | 1113 | ||
@@ -1139,7 +1139,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, | |||
1139 | return -EINVAL; | 1139 | return -EINVAL; |
1140 | 1140 | ||
1141 | v6_cork->opt = kzalloc(opt->tot_len, sk->sk_allocation); | 1141 | v6_cork->opt = kzalloc(opt->tot_len, sk->sk_allocation); |
1142 | if (unlikely(v6_cork->opt == NULL)) | 1142 | if (unlikely(!v6_cork->opt)) |
1143 | return -ENOBUFS; | 1143 | return -ENOBUFS; |
1144 | 1144 | ||
1145 | v6_cork->opt->tot_len = opt->tot_len; | 1145 | v6_cork->opt->tot_len = opt->tot_len; |
@@ -1331,7 +1331,7 @@ alloc_new_skb: | |||
1331 | else | 1331 | else |
1332 | fraggap = 0; | 1332 | fraggap = 0; |
1333 | /* update mtu and maxfraglen if necessary */ | 1333 | /* update mtu and maxfraglen if necessary */ |
1334 | if (skb == NULL || skb_prev == NULL) | 1334 | if (!skb || !skb_prev) |
1335 | ip6_append_data_mtu(&mtu, &maxfraglen, | 1335 | ip6_append_data_mtu(&mtu, &maxfraglen, |
1336 | fragheaderlen, skb, rt, | 1336 | fragheaderlen, skb, rt, |
1337 | orig_mtu); | 1337 | orig_mtu); |
@@ -1383,10 +1383,10 @@ alloc_new_skb: | |||
1383 | skb = sock_wmalloc(sk, | 1383 | skb = sock_wmalloc(sk, |
1384 | alloclen + hh_len, 1, | 1384 | alloclen + hh_len, 1, |
1385 | sk->sk_allocation); | 1385 | sk->sk_allocation); |
1386 | if (unlikely(skb == NULL)) | 1386 | if (unlikely(!skb)) |
1387 | err = -ENOBUFS; | 1387 | err = -ENOBUFS; |
1388 | } | 1388 | } |
1389 | if (skb == NULL) | 1389 | if (!skb) |
1390 | goto error; | 1390 | goto error; |
1391 | /* | 1391 | /* |
1392 | * Fill in the control structures | 1392 | * Fill in the control structures |
@@ -1578,7 +1578,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk, | |||
1578 | unsigned char proto = fl6->flowi6_proto; | 1578 | unsigned char proto = fl6->flowi6_proto; |
1579 | 1579 | ||
1580 | skb = __skb_dequeue(queue); | 1580 | skb = __skb_dequeue(queue); |
1581 | if (skb == NULL) | 1581 | if (!skb) |
1582 | goto out; | 1582 | goto out; |
1583 | tail_skb = &(skb_shinfo(skb)->frag_list); | 1583 | tail_skb = &(skb_shinfo(skb)->frag_list); |
1584 | 1584 | ||