diff options
author | Ian Morris <ipm@chirality.org.uk> | 2015-04-03 04:17:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-03 12:11:15 -0400 |
commit | 51456b2914a34d16b1255b7c55d5cbf6a681d306 (patch) | |
tree | b8f1135150269f591105f787fbf7c7d8c2307d3e /net/ipv4/fib_semantics.c | |
parent | 11a9c7821c583aa22b35f37fba20539def9e8f14 (diff) |
ipv4: coding style: comparison for equality with NULL
The ipv4 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/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index eac5aec7772a..8d695b6659c7 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -390,7 +390,7 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, | |||
390 | int err = -ENOBUFS; | 390 | int err = -ENOBUFS; |
391 | 391 | ||
392 | skb = nlmsg_new(fib_nlmsg_size(fa->fa_info), GFP_KERNEL); | 392 | skb = nlmsg_new(fib_nlmsg_size(fa->fa_info), GFP_KERNEL); |
393 | if (skb == NULL) | 393 | if (!skb) |
394 | goto errout; | 394 | goto errout; |
395 | 395 | ||
396 | err = fib_dump_info(skb, info->portid, seq, event, tb_id, | 396 | err = fib_dump_info(skb, info->portid, seq, event, tb_id, |
@@ -503,7 +503,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) | |||
503 | } | 503 | } |
504 | 504 | ||
505 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 505 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
506 | if (cfg->fc_mp == NULL) | 506 | if (!cfg->fc_mp) |
507 | return 0; | 507 | return 0; |
508 | 508 | ||
509 | rtnh = cfg->fc_mp; | 509 | rtnh = cfg->fc_mp; |
@@ -646,7 +646,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, | |||
646 | rcu_read_lock(); | 646 | rcu_read_lock(); |
647 | err = -ENODEV; | 647 | err = -ENODEV; |
648 | in_dev = inetdev_by_index(net, nh->nh_oif); | 648 | in_dev = inetdev_by_index(net, nh->nh_oif); |
649 | if (in_dev == NULL) | 649 | if (!in_dev) |
650 | goto out; | 650 | goto out; |
651 | err = -ENETDOWN; | 651 | err = -ENETDOWN; |
652 | if (!(in_dev->dev->flags & IFF_UP)) | 652 | if (!(in_dev->dev->flags & IFF_UP)) |
@@ -803,7 +803,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg) | |||
803 | } | 803 | } |
804 | 804 | ||
805 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); | 805 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); |
806 | if (fi == NULL) | 806 | if (!fi) |
807 | goto failure; | 807 | goto failure; |
808 | fib_info_cnt++; | 808 | fib_info_cnt++; |
809 | if (cfg->fc_mx) { | 809 | if (cfg->fc_mx) { |
@@ -921,7 +921,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg) | |||
921 | nh->nh_scope = RT_SCOPE_NOWHERE; | 921 | nh->nh_scope = RT_SCOPE_NOWHERE; |
922 | nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif); | 922 | nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif); |
923 | err = -ENODEV; | 923 | err = -ENODEV; |
924 | if (nh->nh_dev == NULL) | 924 | if (!nh->nh_dev) |
925 | goto failure; | 925 | goto failure; |
926 | } else { | 926 | } else { |
927 | change_nexthops(fi) { | 927 | change_nexthops(fi) { |
@@ -995,7 +995,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
995 | struct rtmsg *rtm; | 995 | struct rtmsg *rtm; |
996 | 996 | ||
997 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*rtm), flags); | 997 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*rtm), flags); |
998 | if (nlh == NULL) | 998 | if (!nlh) |
999 | return -EMSGSIZE; | 999 | return -EMSGSIZE; |
1000 | 1000 | ||
1001 | rtm = nlmsg_data(nlh); | 1001 | rtm = nlmsg_data(nlh); |
@@ -1045,12 +1045,12 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1045 | struct nlattr *mp; | 1045 | struct nlattr *mp; |
1046 | 1046 | ||
1047 | mp = nla_nest_start(skb, RTA_MULTIPATH); | 1047 | mp = nla_nest_start(skb, RTA_MULTIPATH); |
1048 | if (mp == NULL) | 1048 | if (!mp) |
1049 | goto nla_put_failure; | 1049 | goto nla_put_failure; |
1050 | 1050 | ||
1051 | for_nexthops(fi) { | 1051 | for_nexthops(fi) { |
1052 | rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); | 1052 | rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); |
1053 | if (rtnh == NULL) | 1053 | if (!rtnh) |
1054 | goto nla_put_failure; | 1054 | goto nla_put_failure; |
1055 | 1055 | ||
1056 | rtnh->rtnh_flags = nh->nh_flags & 0xFF; | 1056 | rtnh->rtnh_flags = nh->nh_flags & 0xFF; |
@@ -1093,7 +1093,7 @@ int fib_sync_down_addr(struct net *net, __be32 local) | |||
1093 | struct hlist_head *head = &fib_info_laddrhash[hash]; | 1093 | struct hlist_head *head = &fib_info_laddrhash[hash]; |
1094 | struct fib_info *fi; | 1094 | struct fib_info *fi; |
1095 | 1095 | ||
1096 | if (fib_info_laddrhash == NULL || local == 0) | 1096 | if (!fib_info_laddrhash || local == 0) |
1097 | return 0; | 1097 | return 0; |
1098 | 1098 | ||
1099 | hlist_for_each_entry(fi, head, fib_lhash) { | 1099 | hlist_for_each_entry(fi, head, fib_lhash) { |
@@ -1182,7 +1182,7 @@ void fib_select_default(struct fib_result *res) | |||
1182 | 1182 | ||
1183 | fib_alias_accessed(fa); | 1183 | fib_alias_accessed(fa); |
1184 | 1184 | ||
1185 | if (fi == NULL) { | 1185 | if (!fi) { |
1186 | if (next_fi != res->fi) | 1186 | if (next_fi != res->fi) |
1187 | break; | 1187 | break; |
1188 | } else if (!fib_detect_death(fi, order, &last_resort, | 1188 | } else if (!fib_detect_death(fi, order, &last_resort, |
@@ -1195,7 +1195,7 @@ void fib_select_default(struct fib_result *res) | |||
1195 | order++; | 1195 | order++; |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | if (order <= 0 || fi == NULL) { | 1198 | if (order <= 0 || !fi) { |
1199 | tb->tb_default = -1; | 1199 | tb->tb_default = -1; |
1200 | goto out; | 1200 | goto out; |
1201 | } | 1201 | } |
@@ -1251,7 +1251,7 @@ int fib_sync_up(struct net_device *dev) | |||
1251 | alive++; | 1251 | alive++; |
1252 | continue; | 1252 | continue; |
1253 | } | 1253 | } |
1254 | if (nexthop_nh->nh_dev == NULL || | 1254 | if (!nexthop_nh->nh_dev || |
1255 | !(nexthop_nh->nh_dev->flags & IFF_UP)) | 1255 | !(nexthop_nh->nh_dev->flags & IFF_UP)) |
1256 | continue; | 1256 | continue; |
1257 | if (nexthop_nh->nh_dev != dev || | 1257 | if (nexthop_nh->nh_dev != dev || |