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/devinet.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/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index c6473f365ad1..0ee21689d37e 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -585,7 +585,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
585 | 585 | ||
586 | ifm = nlmsg_data(nlh); | 586 | ifm = nlmsg_data(nlh); |
587 | in_dev = inetdev_by_index(net, ifm->ifa_index); | 587 | in_dev = inetdev_by_index(net, ifm->ifa_index); |
588 | if (in_dev == NULL) { | 588 | if (!in_dev) { |
589 | err = -ENODEV; | 589 | err = -ENODEV; |
590 | goto errout; | 590 | goto errout; |
591 | } | 591 | } |
@@ -755,21 +755,21 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
755 | 755 | ||
756 | ifm = nlmsg_data(nlh); | 756 | ifm = nlmsg_data(nlh); |
757 | err = -EINVAL; | 757 | err = -EINVAL; |
758 | if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) | 758 | if (ifm->ifa_prefixlen > 32 || !tb[IFA_LOCAL]) |
759 | goto errout; | 759 | goto errout; |
760 | 760 | ||
761 | dev = __dev_get_by_index(net, ifm->ifa_index); | 761 | dev = __dev_get_by_index(net, ifm->ifa_index); |
762 | err = -ENODEV; | 762 | err = -ENODEV; |
763 | if (dev == NULL) | 763 | if (!dev) |
764 | goto errout; | 764 | goto errout; |
765 | 765 | ||
766 | in_dev = __in_dev_get_rtnl(dev); | 766 | in_dev = __in_dev_get_rtnl(dev); |
767 | err = -ENOBUFS; | 767 | err = -ENOBUFS; |
768 | if (in_dev == NULL) | 768 | if (!in_dev) |
769 | goto errout; | 769 | goto errout; |
770 | 770 | ||
771 | ifa = inet_alloc_ifa(); | 771 | ifa = inet_alloc_ifa(); |
772 | if (ifa == NULL) | 772 | if (!ifa) |
773 | /* | 773 | /* |
774 | * A potential indev allocation can be left alive, it stays | 774 | * A potential indev allocation can be left alive, it stays |
775 | * assigned to its device and is destroy with it. | 775 | * assigned to its device and is destroy with it. |
@@ -780,7 +780,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
780 | neigh_parms_data_state_setall(in_dev->arp_parms); | 780 | neigh_parms_data_state_setall(in_dev->arp_parms); |
781 | in_dev_hold(in_dev); | 781 | in_dev_hold(in_dev); |
782 | 782 | ||
783 | if (tb[IFA_ADDRESS] == NULL) | 783 | if (!tb[IFA_ADDRESS]) |
784 | tb[IFA_ADDRESS] = tb[IFA_LOCAL]; | 784 | tb[IFA_ADDRESS] = tb[IFA_LOCAL]; |
785 | 785 | ||
786 | INIT_HLIST_NODE(&ifa->hash); | 786 | INIT_HLIST_NODE(&ifa->hash); |
@@ -1340,7 +1340,7 @@ static void inetdev_changename(struct net_device *dev, struct in_device *in_dev) | |||
1340 | if (named++ == 0) | 1340 | if (named++ == 0) |
1341 | goto skip; | 1341 | goto skip; |
1342 | dot = strchr(old, ':'); | 1342 | dot = strchr(old, ':'); |
1343 | if (dot == NULL) { | 1343 | if (!dot) { |
1344 | sprintf(old, ":%d", named); | 1344 | sprintf(old, ":%d", named); |
1345 | dot = old; | 1345 | dot = old; |
1346 | } | 1346 | } |
@@ -1509,7 +1509,7 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, | |||
1509 | u32 preferred, valid; | 1509 | u32 preferred, valid; |
1510 | 1510 | ||
1511 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*ifm), flags); | 1511 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*ifm), flags); |
1512 | if (nlh == NULL) | 1512 | if (!nlh) |
1513 | return -EMSGSIZE; | 1513 | return -EMSGSIZE; |
1514 | 1514 | ||
1515 | ifm = nlmsg_data(nlh); | 1515 | ifm = nlmsg_data(nlh); |
@@ -1628,7 +1628,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, | |||
1628 | 1628 | ||
1629 | net = dev_net(ifa->ifa_dev->dev); | 1629 | net = dev_net(ifa->ifa_dev->dev); |
1630 | skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); | 1630 | skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); |
1631 | if (skb == NULL) | 1631 | if (!skb) |
1632 | goto errout; | 1632 | goto errout; |
1633 | 1633 | ||
1634 | err = inet_fill_ifaddr(skb, ifa, portid, seq, event, 0); | 1634 | err = inet_fill_ifaddr(skb, ifa, portid, seq, event, 0); |
@@ -1665,7 +1665,7 @@ static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev) | |||
1665 | return -ENODATA; | 1665 | return -ENODATA; |
1666 | 1666 | ||
1667 | nla = nla_reserve(skb, IFLA_INET_CONF, IPV4_DEVCONF_MAX * 4); | 1667 | nla = nla_reserve(skb, IFLA_INET_CONF, IPV4_DEVCONF_MAX * 4); |
1668 | if (nla == NULL) | 1668 | if (!nla) |
1669 | return -EMSGSIZE; | 1669 | return -EMSGSIZE; |
1670 | 1670 | ||
1671 | for (i = 0; i < IPV4_DEVCONF_MAX; i++) | 1671 | for (i = 0; i < IPV4_DEVCONF_MAX; i++) |
@@ -1754,7 +1754,7 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex, | |||
1754 | 1754 | ||
1755 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg), | 1755 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg), |
1756 | flags); | 1756 | flags); |
1757 | if (nlh == NULL) | 1757 | if (!nlh) |
1758 | return -EMSGSIZE; | 1758 | return -EMSGSIZE; |
1759 | 1759 | ||
1760 | ncm = nlmsg_data(nlh); | 1760 | ncm = nlmsg_data(nlh); |
@@ -1796,7 +1796,7 @@ void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, | |||
1796 | int err = -ENOBUFS; | 1796 | int err = -ENOBUFS; |
1797 | 1797 | ||
1798 | skb = nlmsg_new(inet_netconf_msgsize_devconf(type), GFP_ATOMIC); | 1798 | skb = nlmsg_new(inet_netconf_msgsize_devconf(type), GFP_ATOMIC); |
1799 | if (skb == NULL) | 1799 | if (!skb) |
1800 | goto errout; | 1800 | goto errout; |
1801 | 1801 | ||
1802 | err = inet_netconf_fill_devconf(skb, ifindex, devconf, 0, 0, | 1802 | err = inet_netconf_fill_devconf(skb, ifindex, devconf, 0, 0, |
@@ -1853,10 +1853,10 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb, | |||
1853 | break; | 1853 | break; |
1854 | default: | 1854 | default: |
1855 | dev = __dev_get_by_index(net, ifindex); | 1855 | dev = __dev_get_by_index(net, ifindex); |
1856 | if (dev == NULL) | 1856 | if (!dev) |
1857 | goto errout; | 1857 | goto errout; |
1858 | in_dev = __in_dev_get_rtnl(dev); | 1858 | in_dev = __in_dev_get_rtnl(dev); |
1859 | if (in_dev == NULL) | 1859 | if (!in_dev) |
1860 | goto errout; | 1860 | goto errout; |
1861 | devconf = &in_dev->cnf; | 1861 | devconf = &in_dev->cnf; |
1862 | break; | 1862 | break; |
@@ -1864,7 +1864,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb, | |||
1864 | 1864 | ||
1865 | err = -ENOBUFS; | 1865 | err = -ENOBUFS; |
1866 | skb = nlmsg_new(inet_netconf_msgsize_devconf(-1), GFP_ATOMIC); | 1866 | skb = nlmsg_new(inet_netconf_msgsize_devconf(-1), GFP_ATOMIC); |
1867 | if (skb == NULL) | 1867 | if (!skb) |
1868 | goto errout; | 1868 | goto errout; |
1869 | 1869 | ||
1870 | err = inet_netconf_fill_devconf(skb, ifindex, devconf, | 1870 | err = inet_netconf_fill_devconf(skb, ifindex, devconf, |
@@ -2215,7 +2215,7 @@ static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf) | |||
2215 | { | 2215 | { |
2216 | struct devinet_sysctl_table *t = cnf->sysctl; | 2216 | struct devinet_sysctl_table *t = cnf->sysctl; |
2217 | 2217 | ||
2218 | if (t == NULL) | 2218 | if (!t) |
2219 | return; | 2219 | return; |
2220 | 2220 | ||
2221 | cnf->sysctl = NULL; | 2221 | cnf->sysctl = NULL; |
@@ -2276,16 +2276,16 @@ static __net_init int devinet_init_net(struct net *net) | |||
2276 | 2276 | ||
2277 | if (!net_eq(net, &init_net)) { | 2277 | if (!net_eq(net, &init_net)) { |
2278 | all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); | 2278 | all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); |
2279 | if (all == NULL) | 2279 | if (!all) |
2280 | goto err_alloc_all; | 2280 | goto err_alloc_all; |
2281 | 2281 | ||
2282 | dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL); | 2282 | dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL); |
2283 | if (dflt == NULL) | 2283 | if (!dflt) |
2284 | goto err_alloc_dflt; | 2284 | goto err_alloc_dflt; |
2285 | 2285 | ||
2286 | #ifdef CONFIG_SYSCTL | 2286 | #ifdef CONFIG_SYSCTL |
2287 | tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL); | 2287 | tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL); |
2288 | if (tbl == NULL) | 2288 | if (!tbl) |
2289 | goto err_alloc_ctl; | 2289 | goto err_alloc_ctl; |
2290 | 2290 | ||
2291 | tbl[0].data = &all->data[IPV4_DEVCONF_FORWARDING - 1]; | 2291 | tbl[0].data = &all->data[IPV4_DEVCONF_FORWARDING - 1]; |
@@ -2305,7 +2305,7 @@ static __net_init int devinet_init_net(struct net *net) | |||
2305 | 2305 | ||
2306 | err = -ENOMEM; | 2306 | err = -ENOMEM; |
2307 | forw_hdr = register_net_sysctl(net, "net/ipv4", tbl); | 2307 | forw_hdr = register_net_sysctl(net, "net/ipv4", tbl); |
2308 | if (forw_hdr == NULL) | 2308 | if (!forw_hdr) |
2309 | goto err_reg_ctl; | 2309 | goto err_reg_ctl; |
2310 | net->ipv4.forw_hdr = forw_hdr; | 2310 | net->ipv4.forw_hdr = forw_hdr; |
2311 | #endif | 2311 | #endif |