drivers/net: Remove pointless checks for NULL prior to calling kfree()
authorJesper Juhl <jesper.juhl@gmail.com>
Fri, 28 Oct 2005 20:53:13 +0000 (16:53 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 28 Oct 2005 20:53:13 +0000 (16:53 -0400)
32 files changed:
drivers/net/acenic.c
drivers/net/au1000_eth.c
drivers/net/b44.c
drivers/net/bmac.c
drivers/net/bnx2.c
drivers/net/e1000/e1000_ethtool.c
drivers/net/hamradio/mkiss.c
drivers/net/ibmveth.c
drivers/net/irda/donauboe.c
drivers/net/irda/irda-usb.c
drivers/net/irda/irport.c
drivers/net/irda/sir_dev.c
drivers/net/irda/vlsi_ir.c
drivers/net/mace.c
drivers/net/ni65.c
drivers/net/rrunner.c
drivers/net/s2io.c
drivers/net/saa9730.c
drivers/net/tg3.c
drivers/net/tulip/de2104x.c
drivers/net/tulip/tulip_core.c
drivers/net/via-velocity.c
drivers/net/wireless/airo.c
drivers/net/wireless/airo_cs.c
drivers/net/wireless/atmel.c
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/hostap/hostap_ioctl.c
drivers/net/wireless/prism54/islpci_dev.c
drivers/net/wireless/prism54/oid_mgt.c
drivers/net/wireless/strip.c
include/net/ax25.h
include/net/netrom.h

index dbecc6bf78519ce09088cad0e0b48d96200a8c07..b8953de5664a4cdf091374af819525518414a6cd 100644 (file)
@@ -871,10 +871,8 @@ static void ace_init_cleanup(struct net_device *dev)
        if (ap->info)
                pci_free_consistent(ap->pdev, sizeof(struct ace_info),
                                    ap->info, ap->info_dma);
-       if (ap->skb)
-               kfree(ap->skb);
-       if (ap->trace_buf)
-               kfree(ap->trace_buf);
+       kfree(ap->skb);
+       kfree(ap->trace_buf);
 
        if (dev->irq)
                free_irq(dev->irq, dev);
index 78506911d6566d96efdadf6464b828ebd4d3d6cb..332e9953c55cdd4d80a50ba1fcfcaa0be6d52b45 100644 (file)
@@ -1606,8 +1606,7 @@ err_out:
        /* here we should have a valid dev plus aup-> register addresses
         * so we can reset the mac properly.*/
        reset_mac(dev);
-       if (aup->mii)
-               kfree(aup->mii);
+       kfree(aup->mii);
        for (i = 0; i < NUM_RX_DMA; i++) {
                if (aup->rx_db_inuse[i])
                        ReleaseDB(aup, aup->rx_db_inuse[i]);
@@ -1806,8 +1805,7 @@ static void __exit au1000_cleanup_module(void)
                if (dev) {
                        aup = (struct au1000_private *) dev->priv;
                        unregister_netdev(dev);
-                       if (aup->mii)
-                               kfree(aup->mii);
+                       kfree(aup->mii);
                        for (j = 0; j < NUM_RX_DMA; j++) {
                                if (aup->rx_db_inuse[j])
                                        ReleaseDB(aup, aup->rx_db_inuse[j]);
index ab845076ff9fd0a606c568a2abbecce3da92a7d6..5485e3b1cd353c8ec76e72bec3923af6caec1de9 100644 (file)
@@ -1131,14 +1131,10 @@ static void b44_init_rings(struct b44 *bp)
  */
 static void b44_free_consistent(struct b44 *bp)
 {
-       if (bp->rx_buffers) {
-               kfree(bp->rx_buffers);
-               bp->rx_buffers = NULL;
-       }
-       if (bp->tx_buffers) {
-               kfree(bp->tx_buffers);
-               bp->tx_buffers = NULL;
-       }
+       kfree(bp->rx_buffers);
+       bp->rx_buffers = NULL;
+       kfree(bp->tx_buffers);
+       bp->tx_buffers = NULL;
        if (bp->rx_ring) {
                if (bp->flags & B44_FLAG_RX_RING_HACK) {
                        dma_unmap_single(&bp->pdev->dev, bp->rx_ring_dma,
index 60dba4a1ca5ce8d57081088c22d16eeb7a2ee8f6..73f2fcfc557f84297f68a698696fd5b7f92310e8 100644 (file)
@@ -1689,10 +1689,8 @@ static void __exit bmac_exit(void)
 {
        macio_unregister_driver(&bmac_driver);
 
-       if (bmac_emergency_rxbuf != NULL) {
-               kfree(bmac_emergency_rxbuf);
-               bmac_emergency_rxbuf = NULL;
-       }
+       kfree(bmac_emergency_rxbuf);
+       bmac_emergency_rxbuf = NULL;
 }
 
 MODULE_AUTHOR("Randy Gobbel/Paul Mackerras");
index 3a2ace01e444d082daaa31dc30de97c542d19054..11d25231822112b08fc478e64fea577b983a12e7 100644 (file)
@@ -314,20 +314,16 @@ bnx2_free_mem(struct bnx2 *bp)
                                    bp->tx_desc_ring, bp->tx_desc_mapping);
                bp->tx_desc_ring = NULL;
        }
-       if (bp->tx_buf_ring) {
-               kfree(bp->tx_buf_ring);
-               bp->tx_buf_ring = NULL;
-       }
+       kfree(bp->tx_buf_ring);
+       bp->tx_buf_ring = NULL;
        if (bp->rx_desc_ring) {
                pci_free_consistent(bp->pdev,
                                    sizeof(struct rx_bd) * RX_DESC_CNT,
                                    bp->rx_desc_ring, bp->rx_desc_mapping);
                bp->rx_desc_ring = NULL;
        }
-       if (bp->rx_buf_ring) {
-               kfree(bp->rx_buf_ring);
-               bp->rx_buf_ring = NULL;
-       }
+       kfree(bp->rx_buf_ring);
+       bp->rx_buf_ring = NULL;
 }
 
 static int
index 6b9acc7f94a32e12770fc4a3946d0876c8a5af11..9c7feaeaa6a46b264473ced37a56e88402864089 100644 (file)
@@ -965,11 +965,8 @@ e1000_free_desc_rings(struct e1000_adapter *adapter)
        if(rxdr->desc)
                pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma);
 
-       if(txdr->buffer_info)
-               kfree(txdr->buffer_info);
-       if(rxdr->buffer_info)
-               kfree(rxdr->buffer_info);
-
+       kfree(txdr->buffer_info);
+       kfree(rxdr->buffer_info);
        return;
 }
 
index 85d6dc005be0f016aa2b64af184778de4641a37d..3e9accf137e717ac47fe209cfc3621e7bf32960c 100644 (file)
@@ -390,10 +390,8 @@ static void ax_changedmtu(struct mkiss *ax)
                       "MTU change cancelled.\n",
                       ax->dev->name);
                dev->mtu = ax->mtu;
-               if (xbuff != NULL)
-                       kfree(xbuff);
-               if (rbuff != NULL)
-                       kfree(rbuff);
+               kfree(xbuff);
+               kfree(rbuff);
                return;
        }
 
index f5819527ec9d5d64b2c786a3f2bb535d4912b5f8..36da54ad2b7bd0c00e1d504bd94c9eabac67dcb2 100644 (file)
@@ -276,10 +276,8 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter, struct ibm
 {
        int i;
 
-       if(pool->free_map) {
-               kfree(pool->free_map);
-               pool->free_map  = NULL;
-       }
+       kfree(pool->free_map);
+       pool->free_map = NULL;
 
        if(pool->skbuff && pool->dma_addr) {
                for(i = 0; i < pool->size; ++i) {
index 0a08c539c051062ae0cb5e947f4fe38a79f062b2..0282771b1cbb3ca27d625c0b8b60dc8810672fcb 100644 (file)
@@ -1695,11 +1695,9 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
 
 freebufs:
   for (i = 0; i < TX_SLOTS; ++i)
-    if (self->tx_bufs[i])
-      kfree (self->tx_bufs[i]);
+    kfree (self->tx_bufs[i]);
   for (i = 0; i < RX_SLOTS; ++i)
-    if (self->rx_bufs[i])
-      kfree (self->rx_bufs[i]);
+    kfree (self->rx_bufs[i]);
   kfree(self->ringbuf);
 
 freeregion:
index 6c766fdc51a6970a9a7adf1f2a9f5640b5f3b4ad..c22c0517883c2b8566f3b4c1788cbab6b866feda 100644 (file)
@@ -1168,10 +1168,8 @@ static inline void irda_usb_close(struct irda_usb_cb *self)
        unregister_netdev(self->netdev);
 
        /* Remove the speed buffer */
-       if (self->speed_buff != NULL) {
-               kfree(self->speed_buff);
-               self->speed_buff = NULL;
-       }
+       kfree(self->speed_buff);
+       self->speed_buff = NULL;
 }
 
 /********************** USB CONFIG SUBROUTINES **********************/
index 5971315f3fa0c919f835e67ee538d26aae0ccc52..3d016a498e1d928418c1bb02855e37e50cbba49d 100644 (file)
@@ -235,8 +235,7 @@ static int irport_close(struct irport_cb *self)
                   __FUNCTION__, self->io.sir_base);
        release_region(self->io.sir_base, self->io.sir_ext);
 
-       if (self->tx_buff.head)
-               kfree(self->tx_buff.head);
+       kfree(self->tx_buff.head);
        
        if (self->rx_buff.skb)
                kfree_skb(self->rx_buff.skb);
index efc5a8870565220e52e9797cb51259aba1a63217..df22b8b532e748286ff6a5e4d0e9bb0e2cc45e78 100644 (file)
@@ -490,8 +490,7 @@ static void sirdev_free_buffers(struct sir_dev *dev)
 {
        if (dev->rx_buff.skb)
                kfree_skb(dev->rx_buff.skb);
-       if (dev->tx_buff.head)
-               kfree(dev->tx_buff.head);
+       kfree(dev->tx_buff.head);
        dev->rx_buff.head = dev->tx_buff.head = NULL;
        dev->rx_buff.skb = NULL;
 }
index 651c5a6578fd35cc8dd69a3e70ff3341c5366329..a9f49f058cfb0e2c9a1c625cfcfa9d482c03e14d 100644 (file)
@@ -473,8 +473,7 @@ static int vlsi_free_ring(struct vlsi_ring *r)
                rd_set_addr_status(rd, 0, 0);
                if (busaddr)
                        pci_unmap_single(r->pdev, busaddr, r->len, r->dir);
-               if (rd->buf)
-                       kfree(rd->buf);
+               kfree(rd->buf);
        }
        kfree(r);
        return 0;
index 81d0a26e4f41c00662f5984469b3fad209b96d67..09b1e7b364e5a94b3348cd7eb99d29fcf6b3d036 100644 (file)
@@ -1035,10 +1035,8 @@ static void __exit mace_cleanup(void)
 {
        macio_unregister_driver(&mace_driver);
 
-       if (dummy_buf) {
-               kfree(dummy_buf);
-               dummy_buf = NULL;
-       }
+       kfree(dummy_buf);
+       dummy_buf = NULL;
 }
 
 MODULE_AUTHOR("Paul Mackerras");
index 925d1dfcc4dc1f3fcfaad88827e31581a0d06591..bb42ff2184848df705d61f6418f3471d05c2677f 100644 (file)
@@ -696,8 +696,7 @@ static void ni65_free_buffer(struct priv *p)
                return;
 
        for(i=0;i<TMDNUM;i++) {
-               if(p->tmdbounce[i])
-                       kfree(p->tmdbounce[i]);
+               kfree(p->tmdbounce[i]);
 #ifdef XMT_VIA_SKB
                if(p->tmd_skb[i])
                        dev_kfree_skb(p->tmd_skb[i]);
@@ -710,12 +709,10 @@ static void ni65_free_buffer(struct priv *p)
                if(p->recv_skb[i])
                        dev_kfree_skb(p->recv_skb[i]);
 #else
-               if(p->recvbounce[i])
-                       kfree(p->recvbounce[i]);
+               kfree(p->recvbounce[i]);
 #endif
        }
-       if(p->self)
-               kfree(p->self);
+       kfree(p->self);
 }
 
 
index ec1a18d189a129a816c2c194bb56e489b20245d6..19c2df9c86fe9bc6902dc306ae0ef691505e746f 100644 (file)
@@ -1710,10 +1710,8 @@ static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                        error = -EFAULT;
                }
        wf_out:
-               if (oldimage)
-                       kfree(oldimage);
-               if (image)
-                       kfree(image);
+               kfree(oldimage);
+               kfree(image);
                return error;
                
        case SIOCRRID:
index d303d162974f9caedf905bd603c583a8b6c538b9..5ea897714a14b16fa169f4e4ffb9d12ba23b1190 100644 (file)
@@ -705,8 +705,7 @@ static void free_shared_mem(struct s2io_nic *nic)
                        }
                        kfree(mac_control->rings[i].ba[j]);
                }
-               if (mac_control->rings[i].ba)
-                       kfree(mac_control->rings[i].ba);
+               kfree(mac_control->rings[i].ba);
        }
 #endif
 
index fd0167077fbeacaa164b5aa8b71afa58c7ce7931..110e777f206e6199eaa3334b07aaf80cb85ef3ba 100644 (file)
@@ -997,10 +997,7 @@ static void __devexit saa9730_remove_one(struct pci_dev *pdev)
 
         if (dev) {
                 unregister_netdev(dev);
-
-               if (dev->priv)
-                       kfree(dev->priv);
-
+               kfree(dev->priv);
                 free_netdev(dev);
                 pci_release_regions(pdev);
                 pci_disable_device(pdev);
@@ -1096,8 +1093,7 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
        return 0;
 
  out:
-       if (dev->priv)
-               kfree(dev->priv);
+       kfree(dev->priv);
        return ret;
 }
 
index 551c9449322d9fd9379013173411cba9a367ea52..b547233ad9f726816f31e3d42b19b5477f8d9766 100644 (file)
@@ -3918,10 +3918,8 @@ static void tg3_init_rings(struct tg3 *tp)
  */
 static void tg3_free_consistent(struct tg3 *tp)
 {
-       if (tp->rx_std_buffers) {
-               kfree(tp->rx_std_buffers);
-               tp->rx_std_buffers = NULL;
-       }
+       kfree(tp->rx_std_buffers);
+       tp->rx_std_buffers = NULL;
        if (tp->rx_std) {
                pci_free_consistent(tp->pdev, TG3_RX_RING_BYTES,
                                    tp->rx_std, tp->rx_std_mapping);
index 6b8eee8f7bfd1ddc611498812a59ac7eb8f1976b..d7fb3ffe06acbbf4f85f5b93b7a7c6db0f238b98 100644 (file)
@@ -2076,8 +2076,7 @@ static int __init de_init_one (struct pci_dev *pdev,
        return 0;
 
 err_out_iomap:
-       if (de->ee_data)
-               kfree(de->ee_data);
+       kfree(de->ee_data);
        iounmap(regs);
 err_out_res:
        pci_release_regions(pdev);
@@ -2096,8 +2095,7 @@ static void __exit de_remove_one (struct pci_dev *pdev)
        if (!dev)
                BUG();
        unregister_netdev(dev);
-       if (de->ee_data)
-               kfree(de->ee_data);
+       kfree(de->ee_data);
        iounmap(de->regs);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
index 6266a9a7e6e3a36430b33039af682f3dbdd15607..125ed00e95a5b933445bfe79708702e43324d264 100644 (file)
@@ -1727,8 +1727,7 @@ err_out_free_ring:
                             tp->rx_ring, tp->rx_ring_dma);
 
 err_out_mtable:
-       if (tp->mtable)
-               kfree (tp->mtable);
+       kfree (tp->mtable);
        pci_iounmap(pdev, ioaddr);
 
 err_out_free_res:
@@ -1806,8 +1805,7 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev)
                             sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
                             sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
                             tp->rx_ring, tp->rx_ring_dma);
-       if (tp->mtable)
-               kfree (tp->mtable);
+       kfree (tp->mtable);
        pci_iounmap(pdev, tp->base_addr);
        free_netdev (dev);
        pci_release_regions (pdev);
index abc5cee6eedc28d87f8d75e13b1ccb1b7268b074..a368d08e7d1927fbcaa825b2efe639598b470598 100644 (file)
@@ -1212,10 +1212,8 @@ static void velocity_free_td_ring(struct velocity_info *vptr)
                        velocity_free_td_ring_entry(vptr, j, i);
 
                }
-               if (vptr->td_infos[j]) {
-                       kfree(vptr->td_infos[j]);
-                       vptr->td_infos[j] = NULL;
-               }
+               kfree(vptr->td_infos[j]);
+               vptr->td_infos[j] = NULL;
        }
 }
 
index cb429e783749ab2e02f14af9e4cdcdae63c1e6b6..4c11699bad9123c7166e1bac73b54b7f8525cc41 100644 (file)
@@ -2381,14 +2381,10 @@ void stop_airo_card( struct net_device *dev, int freeres )
                        dev_kfree_skb(skb);
        }
 
-       if (ai->flash)
-               kfree(ai->flash);
-       if (ai->rssi)
-               kfree(ai->rssi);
-       if (ai->APList)
-               kfree(ai->APList);
-       if (ai->SSID)
-               kfree(ai->SSID);
+       kfree(ai->flash);
+       kfree(ai->rssi);
+       kfree(ai->APList);
+       kfree(ai->SSID);
        if (freeres) {
                /* PCMCIA frees this stuff, so only for PCI and ISA */
                release_region( dev->base_addr, 64 );
@@ -3626,10 +3622,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
        int rc;
 
        memset( &mySsid, 0, sizeof( mySsid ) );
-       if (ai->flash) {
-               kfree (ai->flash);
-               ai->flash = NULL;
-       }
+       kfree (ai->flash);
+       ai->flash = NULL;
 
        /* The NOP is the first step in getting the card going */
        cmd.cmd = NOP;
@@ -3666,14 +3660,10 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
                tdsRssiRid rssi_rid;
                CapabilityRid cap_rid;
 
-               if (ai->APList) {
-                       kfree(ai->APList);
-                       ai->APList = NULL;
-               }
-               if (ai->SSID) {
-                       kfree(ai->SSID);
-                       ai->SSID = NULL;
-               }
+               kfree(ai->APList);
+               ai->APList = NULL;
+               kfree(ai->SSID);
+               ai->SSID = NULL;
                // general configuration (read/modify/write)
                status = readConfigRid(ai, lock);
                if ( status != SUCCESS ) return ERROR;
@@ -3687,10 +3677,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
                                memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */
                }
                else {
-                       if (ai->rssi) {
-                               kfree(ai->rssi);
-                               ai->rssi = NULL;
-                       }
+                       kfree(ai->rssi);
+                       ai->rssi = NULL;
                        if (cap_rid.softCap & 8)
                                ai->config.rmode |= RXMODE_NORMALIZED_RSSI;
                        else
@@ -5369,11 +5357,13 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
 
 static int proc_close( struct inode *inode, struct file *file )
 {
-       struct proc_data *data = (struct proc_data *)file->private_data;
-       if ( data->on_close != NULL ) data->on_close( inode, file );
-       if ( data->rbuffer ) kfree( data->rbuffer );
-       if ( data->wbuffer ) kfree( data->wbuffer );
-       kfree( data );
+       struct proc_data *data = file->private_data;
+
+       if (data->on_close != NULL)
+               data->on_close(inode, file);
+       kfree(data->rbuffer);
+       kfree(data->wbuffer);
+       kfree(data);
        return 0;
 }
 
index bf25584d68d3d7f9fd00dc5e64b58d77c72e10bb..784de9109113bac53a86d879bb28e245451bc755 100644 (file)
@@ -258,9 +258,7 @@ static void airo_detach(dev_link_t *link)
        
        /* Unlink device structure, free pieces */
        *linkp = link->next;
-       if (link->priv) {
-               kfree(link->priv);
-       }
+       kfree(link->priv);
        kfree(link);
        
 } /* airo_detach */
index d57011028b7279ef576191c006fd392027c16802..1fbe027d26b6266768654b300b3ed0f962d8787a 100644 (file)
@@ -1653,8 +1653,7 @@ void stop_atmel_card(struct net_device *dev, int freeres)
        unregister_netdev(dev);
        remove_proc_entry("driver/atmel", NULL);
        free_irq(dev->irq, dev);
-       if (priv->firmware)
-               kfree(priv->firmware);
+       kfree(priv->firmware);
        if (freeres) {
                /* PCMCIA frees this stuff, so only for PCI */
                release_region(dev->base_addr, 64);
@@ -2450,8 +2449,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                        break;
                }
 
-               if (priv->firmware)
-                       kfree(priv->firmware);
+               kfree(priv->firmware);
                
                priv->firmware = new_firmware;
                priv->firmware_length = com.len;
index ff031a3985b32310a82f72bccdd6bcf97776572c..195cb36619e859ea2475ee3032adc78d9826e9ec 100644 (file)
@@ -259,8 +259,7 @@ static void atmel_detach(dev_link_t *link)
 
        /* Unlink device structure, free pieces */
        *linkp = link->next;
-       if (link->priv)
-               kfree(link->priv);
+       kfree(link->priv);
        kfree(link);
 }
 
index 53f5246c40aa3bb7bc00eaf80e015a54a7718ec4..2617d70bcda945814a96fbdf7fde59f79930cdb1 100644 (file)
@@ -552,7 +552,6 @@ static int prism2_ioctl_giwaplist(struct net_device *dev,
 
        kfree(addr);
        kfree(qual);
-
        return 0;
 }
 
@@ -3081,9 +3080,7 @@ static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p)
        ret = local->func->download(local, param);
 
  out:
-       if (param != NULL)
-               kfree(param);
-
+       kfree(param);
        return ret;
 }
 #endif /* PRISM2_DOWNLOAD_SUPPORT */
@@ -3890,9 +3887,7 @@ static int prism2_ioctl_priv_hostapd(local_info_t *local, struct iw_point *p)
        }
 
  out:
-       if (param != NULL)
-               kfree(param);
-
+       kfree(param);
        return ret;
 }
 
index 6c9584a9f284dc1b357af18804d6856b47260156..78bdb359835ef5945ae964882c04a95d3731e371 100644 (file)
@@ -754,8 +754,7 @@ islpci_free_memory(islpci_private *priv)
                        pci_unmap_single(priv->pdev, buf->pci_addr,
                                         buf->size, PCI_DMA_FROMDEVICE);
                buf->pci_addr = 0;
-               if (buf->mem)
-                       kfree(buf->mem);
+               kfree(buf->mem);
                buf->size = 0;
                buf->mem = NULL;
         }
index 12123e24b11332d6514fcee22c98975620a790b8..eea2f04c8c6d4149b7a85b50f5f5390358eb8d66 100644 (file)
@@ -268,11 +268,10 @@ mgt_clean(islpci_private *priv)
 
        if (!priv->mib)
                return;
-       for (i = 0; i < OID_NUM_LAST; i++)
-               if (priv->mib[i]) {
-                       kfree(priv->mib[i]);
-                       priv->mib[i] = NULL;
-               }
+       for (i = 0; i < OID_NUM_LAST; i++) {
+               kfree(priv->mib[i]);
+               priv->mib[i] = NULL;
+       }
        kfree(priv->mib);
        priv->mib = NULL;
 }
index 7bc7fc823128001f90a01e1c2246a589b7da7ce0..d25264ba0c0e12000780a223c426002dd49d0ea6 100644 (file)
@@ -860,12 +860,9 @@ static int allocate_buffers(struct strip *strip_info, int mtu)
                strip_info->mtu = dev->mtu = mtu;
                return (1);
        }
-       if (r)
-               kfree(r);
-       if (s)
-               kfree(s);
-       if (t)
-               kfree(t);
+       kfree(r);
+       kfree(s);
+       kfree(t);
        return (0);
 }
 
@@ -922,13 +919,9 @@ static int strip_change_mtu(struct net_device *dev, int new_mtu)
        printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
               strip_info->dev->name, old_mtu, strip_info->mtu);
 
-       if (orbuff)
-               kfree(orbuff);
-       if (osbuff)
-               kfree(osbuff);
-       if (otbuff)
-               kfree(otbuff);
-
+       kfree(orbuff);
+       kfree(osbuff);
+       kfree(otbuff);
        return 0;
 }
 
@@ -2498,18 +2491,13 @@ static int strip_close_low(struct net_device *dev)
        /*
         * Free all STRIP frame buffers.
         */
-       if (strip_info->rx_buff) {
-               kfree(strip_info->rx_buff);
-               strip_info->rx_buff = NULL;
-       }
-       if (strip_info->sx_buff) {
-               kfree(strip_info->sx_buff);
-               strip_info->sx_buff = NULL;
-       }
-       if (strip_info->tx_buff) {
-               kfree(strip_info->tx_buff);
-               strip_info->tx_buff = NULL;
-       }
+       kfree(strip_info->rx_buff);
+       strip_info->rx_buff = NULL;
+       kfree(strip_info->sx_buff);
+       strip_info->sx_buff = NULL;
+       kfree(strip_info->tx_buff);
+       strip_info->tx_buff = NULL;
+
        del_timer(&strip_info->idle_timer);
        return 0;
 }
index 30bb4a893237ff8926a0c3f0cb79591ba96a072a..2250a18b0cbb5fe2cb88a51dd5c2f0ca3af70cd2 100644 (file)
@@ -237,8 +237,7 @@ typedef struct ax25_cb {
 static __inline__ void ax25_cb_put(ax25_cb *ax25)
 {
        if (atomic_dec_and_test(&ax25->refcount)) {
-               if (ax25->digipeat)
-                       kfree(ax25->digipeat);
+               kfree(ax25->digipeat);
                kfree(ax25);
        }
 }
index a6bf6e0f606aed23ac8a8b4a2583bc5d7d6a8d19..a5ee53bce62fc1fe546f2331f56190e960178016 100644 (file)
@@ -136,8 +136,7 @@ static __inline__ void nr_node_put(struct nr_node *nr_node)
 static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh)
 {
        if (atomic_dec_and_test(&nr_neigh->refcount)) {
-               if (nr_neigh->digipeat != NULL)
-                       kfree(nr_neigh->digipeat);
+               kfree(nr_neigh->digipeat);
                kfree(nr_neigh);
        }
 }