]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: octeon: Remove comparison to NULL
authorLaura Garcia Liebana <nevola@gmail.com>
Sat, 27 Feb 2016 23:43:12 +0000 (00:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
Comparison to NULL should be avoided in conditions. Chackpatch detected
these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon/ethernet-mdio.c
drivers/staging/octeon/ethernet-mem.c
drivers/staging/octeon/ethernet-rx.c
drivers/staging/octeon/ethernet-tx.c

index 0ac11b1221b74209b6ca226751975cb4bb8c4755..e13a4ab46977cba259a8faaad0a2f22e82ceb365 100644 (file)
@@ -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;
index 5a5cdb3cd740b2902905264b8600b819f0ee7bdc..d6172e4dace57db4b5ba043ac0ff1a9fcde33233 100644 (file)
@@ -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;
index ed553040cfb90645d318c619c79c9db475c27bda..d82c67743ee51fcbb7bf403f01817420b8ad60c6 100644 (file)
@@ -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,
index 94b0e673c00d13d0198d2bc479020446fdc51476..7c63b85504bb28d2f5197e2d32629f7a2da4d506 100644 (file)
@@ -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);