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>
This commit is contained in:

committed by
David S. Miller

parent
11a9c7821c
commit
51456b2914
@@ -228,7 +228,7 @@ static int arp_constructor(struct neighbour *neigh)
|
||||
|
||||
rcu_read_lock();
|
||||
in_dev = __in_dev_get_rcu(dev);
|
||||
if (in_dev == NULL) {
|
||||
if (!in_dev) {
|
||||
rcu_read_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -475,7 +475,7 @@ static inline int arp_fwd_pvlan(struct in_device *in_dev,
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create an arp packet. If (dest_hw == NULL), we create a broadcast
|
||||
* Create an arp packet. If dest_hw is not set, we create a broadcast
|
||||
* message.
|
||||
*/
|
||||
struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
|
||||
@@ -495,7 +495,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
|
||||
*/
|
||||
|
||||
skb = alloc_skb(arp_hdr_len(dev) + hlen + tlen, GFP_ATOMIC);
|
||||
if (skb == NULL)
|
||||
if (!skb)
|
||||
return NULL;
|
||||
|
||||
skb_reserve(skb, hlen);
|
||||
@@ -503,9 +503,9 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
|
||||
arp = (struct arphdr *) skb_put(skb, arp_hdr_len(dev));
|
||||
skb->dev = dev;
|
||||
skb->protocol = htons(ETH_P_ARP);
|
||||
if (src_hw == NULL)
|
||||
if (!src_hw)
|
||||
src_hw = dev->dev_addr;
|
||||
if (dest_hw == NULL)
|
||||
if (!dest_hw)
|
||||
dest_hw = dev->broadcast;
|
||||
|
||||
/*
|
||||
@@ -614,7 +614,7 @@ void arp_send(int type, int ptype, __be32 dest_ip,
|
||||
|
||||
skb = arp_create(type, ptype, dest_ip, dev, src_ip,
|
||||
dest_hw, src_hw, target_hw);
|
||||
if (skb == NULL)
|
||||
if (!skb)
|
||||
return;
|
||||
|
||||
arp_xmit(skb);
|
||||
@@ -644,7 +644,7 @@ static int arp_process(struct sk_buff *skb)
|
||||
* is ARP'able.
|
||||
*/
|
||||
|
||||
if (in_dev == NULL)
|
||||
if (!in_dev)
|
||||
goto out;
|
||||
|
||||
arp = arp_hdr(skb);
|
||||
@@ -808,7 +808,7 @@ static int arp_process(struct sk_buff *skb)
|
||||
is_garp = arp->ar_op == htons(ARPOP_REQUEST) && tip == sip &&
|
||||
inet_addr_type(net, sip) == RTN_UNICAST;
|
||||
|
||||
if (n == NULL &&
|
||||
if (!n &&
|
||||
((arp->ar_op == htons(ARPOP_REPLY) &&
|
||||
inet_addr_type(net, sip) == RTN_UNICAST) || is_garp))
|
||||
n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
|
||||
@@ -900,7 +900,7 @@ out_of_mem:
|
||||
|
||||
static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
if (!dev) {
|
||||
IPV4_DEVCONF_ALL(net, PROXY_ARP) = on;
|
||||
return 0;
|
||||
}
|
||||
@@ -926,7 +926,7 @@ static int arp_req_set_public(struct net *net, struct arpreq *r,
|
||||
return -ENODEV;
|
||||
}
|
||||
if (mask) {
|
||||
if (pneigh_lookup(&arp_tbl, net, &ip, dev, 1) == NULL)
|
||||
if (!pneigh_lookup(&arp_tbl, net, &ip, dev, 1))
|
||||
return -ENOBUFS;
|
||||
return 0;
|
||||
}
|
||||
@@ -947,7 +947,7 @@ static int arp_req_set(struct net *net, struct arpreq *r,
|
||||
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
|
||||
if (r->arp_flags & ATF_PERM)
|
||||
r->arp_flags |= ATF_COM;
|
||||
if (dev == NULL) {
|
||||
if (!dev) {
|
||||
struct rtable *rt = ip_route_output(net, ip, 0, RTO_ONLINK, 0);
|
||||
|
||||
if (IS_ERR(rt))
|
||||
@@ -1067,7 +1067,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
|
||||
return arp_req_delete_public(net, r, dev);
|
||||
|
||||
ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
|
||||
if (dev == NULL) {
|
||||
if (!dev) {
|
||||
struct rtable *rt = ip_route_output(net, ip, 0, RTO_ONLINK, 0);
|
||||
if (IS_ERR(rt))
|
||||
return PTR_ERR(rt);
|
||||
@@ -1116,7 +1116,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
|
||||
if (r.arp_dev[0]) {
|
||||
err = -ENODEV;
|
||||
dev = __dev_get_by_name(net, r.arp_dev);
|
||||
if (dev == NULL)
|
||||
if (!dev)
|
||||
goto out;
|
||||
|
||||
/* Mmmm... It is wrong... ARPHRD_NETROM==0 */
|
||||
|
Reference in New Issue
Block a user