From e8a4e572c4e75900c77a5854eb54a6c9173f9ac6 Mon Sep 17 00:00:00 2001 From: Laura Garcia Liebana Date: Sun, 28 Feb 2016 00:43:12 +0100 Subject: [PATCH] staging: octeon: Remove comparison to NULL Comparison to NULL should be avoided in conditions. Chackpatch detected these issues. Signed-off-by: Laura Garcia Liebana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-mdio.c | 2 +- drivers/staging/octeon/ethernet-mem.c | 4 ++-- drivers/staging/octeon/ethernet-rx.c | 6 +++--- drivers/staging/octeon/ethernet-tx.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index 0ac11b1221b7..e13a4ab46977 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -196,7 +196,7 @@ int cvm_oct_phy_setup_device(struct net_device *dev) priv->phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0, PHY_INTERFACE_MODE_GMII); - if (priv->phydev == NULL) + if (!priv->phydev) return -ENODEV; priv->last_link = 0; diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c index 5a5cdb3cd740..d6172e4dace5 100644 --- a/drivers/staging/octeon/ethernet-mem.c +++ b/drivers/staging/octeon/ethernet-mem.c @@ -34,7 +34,7 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements) while (freed) { struct sk_buff *skb = dev_alloc_skb(size + 256); - if (unlikely(skb == NULL)) + if (unlikely(!skb)) break; skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f)); *(struct sk_buff **)(skb->data - sizeof(void *)) = skb; @@ -98,7 +98,7 @@ static int cvm_oct_fill_hw_memory(int pool, int size, int elements) * just before the block. */ memory = kmalloc(size + 256, GFP_ATOMIC); - if (unlikely(memory == NULL)) { + if (unlikely(!memory)) { pr_warn("Unable to allocate %u bytes for FPA pool %d\n", elements * size, pool); break; diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index ed553040cfb9..d82c67743ee5 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c @@ -209,7 +209,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) prefetch(work); did_work_request = 0; - if (work == NULL) { + if (!work) { if (OCTEON_IS_MODEL(OCTEON_CN68XX)) { cvmx_write_csr(CVMX_SSO_WQ_IQ_DIS, 1ull << pow_receive_group); @@ -416,7 +416,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) } cvm_oct_rx_refill_pool(0); - if (rx_count < budget && napi != NULL) { + if (rx_count < budget && napi) { /* No more work */ napi_complete(napi); enable_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group); @@ -449,7 +449,7 @@ void cvm_oct_rx_initialize(void) } } - if (NULL == dev_for_napi) + if (!dev_for_napi) panic("No net_devices were allocated."); netif_napi_add(dev_for_napi, &cvm_oct_napi, cvm_oct_napi_poll, diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 94b0e673c00d..7c63b85504bb 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -560,7 +560,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) /* Get a packet buffer */ packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL); - if (unlikely(packet_buffer == NULL)) { + if (unlikely(!packet_buffer)) { printk_ratelimited("%s: Failed to allocate a packet buffer\n", dev->name); cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1); -- 2.39.5