drivers/net: Remove pointless checks for NULL prior to calling kfree()

This commit is contained in:
Jesper Juhl 2005-10-28 16:53:13 -04:00 committed by Jeff Garzik
parent 7380a78a97
commit b4558ea93d
32 changed files with 90 additions and 174 deletions

View file

@ -871,10 +871,8 @@ static void ace_init_cleanup(struct net_device *dev)
if (ap->info) if (ap->info)
pci_free_consistent(ap->pdev, sizeof(struct ace_info), pci_free_consistent(ap->pdev, sizeof(struct ace_info),
ap->info, ap->info_dma); ap->info, ap->info_dma);
if (ap->skb) kfree(ap->skb);
kfree(ap->skb); kfree(ap->trace_buf);
if (ap->trace_buf)
kfree(ap->trace_buf);
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);

View file

@ -1606,8 +1606,7 @@ err_out:
/* here we should have a valid dev plus aup-> register addresses /* here we should have a valid dev plus aup-> register addresses
* so we can reset the mac properly.*/ * so we can reset the mac properly.*/
reset_mac(dev); reset_mac(dev);
if (aup->mii) kfree(aup->mii);
kfree(aup->mii);
for (i = 0; i < NUM_RX_DMA; i++) { for (i = 0; i < NUM_RX_DMA; i++) {
if (aup->rx_db_inuse[i]) if (aup->rx_db_inuse[i])
ReleaseDB(aup, 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) { if (dev) {
aup = (struct au1000_private *) dev->priv; aup = (struct au1000_private *) dev->priv;
unregister_netdev(dev); unregister_netdev(dev);
if (aup->mii) kfree(aup->mii);
kfree(aup->mii);
for (j = 0; j < NUM_RX_DMA; j++) { for (j = 0; j < NUM_RX_DMA; j++) {
if (aup->rx_db_inuse[j]) if (aup->rx_db_inuse[j])
ReleaseDB(aup, aup->rx_db_inuse[j]); ReleaseDB(aup, aup->rx_db_inuse[j]);

View file

@ -1131,14 +1131,10 @@ static void b44_init_rings(struct b44 *bp)
*/ */
static void b44_free_consistent(struct b44 *bp) static void b44_free_consistent(struct b44 *bp)
{ {
if (bp->rx_buffers) { kfree(bp->rx_buffers);
kfree(bp->rx_buffers); bp->rx_buffers = NULL;
bp->rx_buffers = NULL; kfree(bp->tx_buffers);
} bp->tx_buffers = NULL;
if (bp->tx_buffers) {
kfree(bp->tx_buffers);
bp->tx_buffers = NULL;
}
if (bp->rx_ring) { if (bp->rx_ring) {
if (bp->flags & B44_FLAG_RX_RING_HACK) { if (bp->flags & B44_FLAG_RX_RING_HACK) {
dma_unmap_single(&bp->pdev->dev, bp->rx_ring_dma, dma_unmap_single(&bp->pdev->dev, bp->rx_ring_dma,

View file

@ -1689,10 +1689,8 @@ static void __exit bmac_exit(void)
{ {
macio_unregister_driver(&bmac_driver); macio_unregister_driver(&bmac_driver);
if (bmac_emergency_rxbuf != NULL) { kfree(bmac_emergency_rxbuf);
kfree(bmac_emergency_rxbuf); bmac_emergency_rxbuf = NULL;
bmac_emergency_rxbuf = NULL;
}
} }
MODULE_AUTHOR("Randy Gobbel/Paul Mackerras"); MODULE_AUTHOR("Randy Gobbel/Paul Mackerras");

View file

@ -314,20 +314,16 @@ bnx2_free_mem(struct bnx2 *bp)
bp->tx_desc_ring, bp->tx_desc_mapping); bp->tx_desc_ring, bp->tx_desc_mapping);
bp->tx_desc_ring = NULL; bp->tx_desc_ring = NULL;
} }
if (bp->tx_buf_ring) { kfree(bp->tx_buf_ring);
kfree(bp->tx_buf_ring); bp->tx_buf_ring = NULL;
bp->tx_buf_ring = NULL;
}
if (bp->rx_desc_ring) { if (bp->rx_desc_ring) {
pci_free_consistent(bp->pdev, pci_free_consistent(bp->pdev,
sizeof(struct rx_bd) * RX_DESC_CNT, sizeof(struct rx_bd) * RX_DESC_CNT,
bp->rx_desc_ring, bp->rx_desc_mapping); bp->rx_desc_ring, bp->rx_desc_mapping);
bp->rx_desc_ring = NULL; bp->rx_desc_ring = NULL;
} }
if (bp->rx_buf_ring) { kfree(bp->rx_buf_ring);
kfree(bp->rx_buf_ring); bp->rx_buf_ring = NULL;
bp->rx_buf_ring = NULL;
}
} }
static int static int

View file

@ -965,11 +965,8 @@ e1000_free_desc_rings(struct e1000_adapter *adapter)
if(rxdr->desc) if(rxdr->desc)
pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma); pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma);
if(txdr->buffer_info) kfree(txdr->buffer_info);
kfree(txdr->buffer_info); kfree(rxdr->buffer_info);
if(rxdr->buffer_info)
kfree(rxdr->buffer_info);
return; return;
} }

View file

@ -390,10 +390,8 @@ static void ax_changedmtu(struct mkiss *ax)
"MTU change cancelled.\n", "MTU change cancelled.\n",
ax->dev->name); ax->dev->name);
dev->mtu = ax->mtu; dev->mtu = ax->mtu;
if (xbuff != NULL) kfree(xbuff);
kfree(xbuff); kfree(rbuff);
if (rbuff != NULL)
kfree(rbuff);
return; return;
} }

View file

@ -276,10 +276,8 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter, struct ibm
{ {
int i; int i;
if(pool->free_map) { kfree(pool->free_map);
kfree(pool->free_map); pool->free_map = NULL;
pool->free_map = NULL;
}
if(pool->skbuff && pool->dma_addr) { if(pool->skbuff && pool->dma_addr) {
for(i = 0; i < pool->size; ++i) { for(i = 0; i < pool->size; ++i) {

View file

@ -1695,11 +1695,9 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
freebufs: freebufs:
for (i = 0; i < TX_SLOTS; ++i) 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) 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); kfree(self->ringbuf);
freeregion: freeregion:

View file

@ -1168,10 +1168,8 @@ static inline void irda_usb_close(struct irda_usb_cb *self)
unregister_netdev(self->netdev); unregister_netdev(self->netdev);
/* Remove the speed buffer */ /* Remove the speed buffer */
if (self->speed_buff != NULL) { kfree(self->speed_buff);
kfree(self->speed_buff); self->speed_buff = NULL;
self->speed_buff = NULL;
}
} }
/********************** USB CONFIG SUBROUTINES **********************/ /********************** USB CONFIG SUBROUTINES **********************/

View file

@ -235,8 +235,7 @@ static int irport_close(struct irport_cb *self)
__FUNCTION__, self->io.sir_base); __FUNCTION__, self->io.sir_base);
release_region(self->io.sir_base, self->io.sir_ext); 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) if (self->rx_buff.skb)
kfree_skb(self->rx_buff.skb); kfree_skb(self->rx_buff.skb);

View file

@ -490,8 +490,7 @@ static void sirdev_free_buffers(struct sir_dev *dev)
{ {
if (dev->rx_buff.skb) if (dev->rx_buff.skb)
kfree_skb(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.head = dev->tx_buff.head = NULL;
dev->rx_buff.skb = NULL; dev->rx_buff.skb = NULL;
} }

View file

@ -473,8 +473,7 @@ static int vlsi_free_ring(struct vlsi_ring *r)
rd_set_addr_status(rd, 0, 0); rd_set_addr_status(rd, 0, 0);
if (busaddr) if (busaddr)
pci_unmap_single(r->pdev, busaddr, r->len, r->dir); pci_unmap_single(r->pdev, busaddr, r->len, r->dir);
if (rd->buf) kfree(rd->buf);
kfree(rd->buf);
} }
kfree(r); kfree(r);
return 0; return 0;

View file

@ -1035,10 +1035,8 @@ static void __exit mace_cleanup(void)
{ {
macio_unregister_driver(&mace_driver); macio_unregister_driver(&mace_driver);
if (dummy_buf) { kfree(dummy_buf);
kfree(dummy_buf); dummy_buf = NULL;
dummy_buf = NULL;
}
} }
MODULE_AUTHOR("Paul Mackerras"); MODULE_AUTHOR("Paul Mackerras");

View file

@ -696,8 +696,7 @@ static void ni65_free_buffer(struct priv *p)
return; return;
for(i=0;i<TMDNUM;i++) { for(i=0;i<TMDNUM;i++) {
if(p->tmdbounce[i]) kfree(p->tmdbounce[i]);
kfree(p->tmdbounce[i]);
#ifdef XMT_VIA_SKB #ifdef XMT_VIA_SKB
if(p->tmd_skb[i]) if(p->tmd_skb[i])
dev_kfree_skb(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]) if(p->recv_skb[i])
dev_kfree_skb(p->recv_skb[i]); dev_kfree_skb(p->recv_skb[i]);
#else #else
if(p->recvbounce[i]) kfree(p->recvbounce[i]);
kfree(p->recvbounce[i]);
#endif #endif
} }
if(p->self) kfree(p->self);
kfree(p->self);
} }

View file

@ -1710,10 +1710,8 @@ static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
error = -EFAULT; error = -EFAULT;
} }
wf_out: wf_out:
if (oldimage) kfree(oldimage);
kfree(oldimage); kfree(image);
if (image)
kfree(image);
return error; return error;
case SIOCRRID: case SIOCRRID:

View file

@ -705,8 +705,7 @@ static void free_shared_mem(struct s2io_nic *nic)
} }
kfree(mac_control->rings[i].ba[j]); 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 #endif

View file

@ -997,10 +997,7 @@ static void __devexit saa9730_remove_one(struct pci_dev *pdev)
if (dev) { if (dev) {
unregister_netdev(dev); unregister_netdev(dev);
kfree(dev->priv);
if (dev->priv)
kfree(dev->priv);
free_netdev(dev); free_netdev(dev);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
@ -1096,8 +1093,7 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
return 0; return 0;
out: out:
if (dev->priv) kfree(dev->priv);
kfree(dev->priv);
return ret; return ret;
} }

View file

@ -3918,10 +3918,8 @@ static void tg3_init_rings(struct tg3 *tp)
*/ */
static void tg3_free_consistent(struct tg3 *tp) static void tg3_free_consistent(struct tg3 *tp)
{ {
if (tp->rx_std_buffers) { kfree(tp->rx_std_buffers);
kfree(tp->rx_std_buffers); tp->rx_std_buffers = NULL;
tp->rx_std_buffers = NULL;
}
if (tp->rx_std) { if (tp->rx_std) {
pci_free_consistent(tp->pdev, TG3_RX_RING_BYTES, pci_free_consistent(tp->pdev, TG3_RX_RING_BYTES,
tp->rx_std, tp->rx_std_mapping); tp->rx_std, tp->rx_std_mapping);

View file

@ -2076,8 +2076,7 @@ static int __init de_init_one (struct pci_dev *pdev,
return 0; return 0;
err_out_iomap: err_out_iomap:
if (de->ee_data) kfree(de->ee_data);
kfree(de->ee_data);
iounmap(regs); iounmap(regs);
err_out_res: err_out_res:
pci_release_regions(pdev); pci_release_regions(pdev);
@ -2096,8 +2095,7 @@ static void __exit de_remove_one (struct pci_dev *pdev)
if (!dev) if (!dev)
BUG(); BUG();
unregister_netdev(dev); unregister_netdev(dev);
if (de->ee_data) kfree(de->ee_data);
kfree(de->ee_data);
iounmap(de->regs); iounmap(de->regs);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);

View file

@ -1727,8 +1727,7 @@ err_out_free_ring:
tp->rx_ring, tp->rx_ring_dma); tp->rx_ring, tp->rx_ring_dma);
err_out_mtable: err_out_mtable:
if (tp->mtable) kfree (tp->mtable);
kfree (tp->mtable);
pci_iounmap(pdev, ioaddr); pci_iounmap(pdev, ioaddr);
err_out_free_res: 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_rx_desc) * RX_RING_SIZE +
sizeof (struct tulip_tx_desc) * TX_RING_SIZE, sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
tp->rx_ring, tp->rx_ring_dma); tp->rx_ring, tp->rx_ring_dma);
if (tp->mtable) kfree (tp->mtable);
kfree (tp->mtable);
pci_iounmap(pdev, tp->base_addr); pci_iounmap(pdev, tp->base_addr);
free_netdev (dev); free_netdev (dev);
pci_release_regions (pdev); pci_release_regions (pdev);

View file

@ -1212,10 +1212,8 @@ static void velocity_free_td_ring(struct velocity_info *vptr)
velocity_free_td_ring_entry(vptr, j, i); velocity_free_td_ring_entry(vptr, j, i);
} }
if (vptr->td_infos[j]) { kfree(vptr->td_infos[j]);
kfree(vptr->td_infos[j]); vptr->td_infos[j] = NULL;
vptr->td_infos[j] = NULL;
}
} }
} }

View file

@ -2381,14 +2381,10 @@ void stop_airo_card( struct net_device *dev, int freeres )
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
if (ai->flash) kfree(ai->flash);
kfree(ai->flash); kfree(ai->rssi);
if (ai->rssi) kfree(ai->APList);
kfree(ai->rssi); kfree(ai->SSID);
if (ai->APList)
kfree(ai->APList);
if (ai->SSID)
kfree(ai->SSID);
if (freeres) { if (freeres) {
/* PCMCIA frees this stuff, so only for PCI and ISA */ /* PCMCIA frees this stuff, so only for PCI and ISA */
release_region( dev->base_addr, 64 ); release_region( dev->base_addr, 64 );
@ -3626,10 +3622,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
int rc; int rc;
memset( &mySsid, 0, sizeof( mySsid ) ); memset( &mySsid, 0, sizeof( mySsid ) );
if (ai->flash) { kfree (ai->flash);
kfree (ai->flash); ai->flash = NULL;
ai->flash = NULL;
}
/* The NOP is the first step in getting the card going */ /* The NOP is the first step in getting the card going */
cmd.cmd = NOP; cmd.cmd = NOP;
@ -3666,14 +3660,10 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
tdsRssiRid rssi_rid; tdsRssiRid rssi_rid;
CapabilityRid cap_rid; CapabilityRid cap_rid;
if (ai->APList) { kfree(ai->APList);
kfree(ai->APList); ai->APList = NULL;
ai->APList = NULL; kfree(ai->SSID);
} ai->SSID = NULL;
if (ai->SSID) {
kfree(ai->SSID);
ai->SSID = NULL;
}
// general configuration (read/modify/write) // general configuration (read/modify/write)
status = readConfigRid(ai, lock); status = readConfigRid(ai, lock);
if ( status != SUCCESS ) return ERROR; 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 */ memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */
} }
else { else {
if (ai->rssi) { kfree(ai->rssi);
kfree(ai->rssi); ai->rssi = NULL;
ai->rssi = NULL;
}
if (cap_rid.softCap & 8) if (cap_rid.softCap & 8)
ai->config.rmode |= RXMODE_NORMALIZED_RSSI; ai->config.rmode |= RXMODE_NORMALIZED_RSSI;
else 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 ) static int proc_close( struct inode *inode, struct file *file )
{ {
struct proc_data *data = (struct proc_data *)file->private_data; struct proc_data *data = file->private_data;
if ( data->on_close != NULL ) data->on_close( inode, file );
if ( data->rbuffer ) kfree( data->rbuffer ); if (data->on_close != NULL)
if ( data->wbuffer ) kfree( data->wbuffer ); data->on_close(inode, file);
kfree( data ); kfree(data->rbuffer);
kfree(data->wbuffer);
kfree(data);
return 0; return 0;
} }

View file

@ -258,9 +258,7 @@ static void airo_detach(dev_link_t *link)
/* Unlink device structure, free pieces */ /* Unlink device structure, free pieces */
*linkp = link->next; *linkp = link->next;
if (link->priv) { kfree(link->priv);
kfree(link->priv);
}
kfree(link); kfree(link);
} /* airo_detach */ } /* airo_detach */

View file

@ -1653,8 +1653,7 @@ void stop_atmel_card(struct net_device *dev, int freeres)
unregister_netdev(dev); unregister_netdev(dev);
remove_proc_entry("driver/atmel", NULL); remove_proc_entry("driver/atmel", NULL);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (priv->firmware) kfree(priv->firmware);
kfree(priv->firmware);
if (freeres) { if (freeres) {
/* PCMCIA frees this stuff, so only for PCI */ /* PCMCIA frees this stuff, so only for PCI */
release_region(dev->base_addr, 64); release_region(dev->base_addr, 64);
@ -2450,8 +2449,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break; break;
} }
if (priv->firmware) kfree(priv->firmware);
kfree(priv->firmware);
priv->firmware = new_firmware; priv->firmware = new_firmware;
priv->firmware_length = com.len; priv->firmware_length = com.len;

View file

@ -259,8 +259,7 @@ static void atmel_detach(dev_link_t *link)
/* Unlink device structure, free pieces */ /* Unlink device structure, free pieces */
*linkp = link->next; *linkp = link->next;
if (link->priv) kfree(link->priv);
kfree(link->priv);
kfree(link); kfree(link);
} }

View file

@ -552,7 +552,6 @@ static int prism2_ioctl_giwaplist(struct net_device *dev,
kfree(addr); kfree(addr);
kfree(qual); kfree(qual);
return 0; 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); ret = local->func->download(local, param);
out: out:
if (param != NULL) kfree(param);
kfree(param);
return ret; return ret;
} }
#endif /* PRISM2_DOWNLOAD_SUPPORT */ #endif /* PRISM2_DOWNLOAD_SUPPORT */
@ -3890,9 +3887,7 @@ static int prism2_ioctl_priv_hostapd(local_info_t *local, struct iw_point *p)
} }
out: out:
if (param != NULL) kfree(param);
kfree(param);
return ret; return ret;
} }

View file

@ -754,8 +754,7 @@ islpci_free_memory(islpci_private *priv)
pci_unmap_single(priv->pdev, buf->pci_addr, pci_unmap_single(priv->pdev, buf->pci_addr,
buf->size, PCI_DMA_FROMDEVICE); buf->size, PCI_DMA_FROMDEVICE);
buf->pci_addr = 0; buf->pci_addr = 0;
if (buf->mem) kfree(buf->mem);
kfree(buf->mem);
buf->size = 0; buf->size = 0;
buf->mem = NULL; buf->mem = NULL;
} }

View file

@ -268,11 +268,10 @@ mgt_clean(islpci_private *priv)
if (!priv->mib) if (!priv->mib)
return; return;
for (i = 0; i < OID_NUM_LAST; i++) for (i = 0; i < OID_NUM_LAST; i++) {
if (priv->mib[i]) { kfree(priv->mib[i]);
kfree(priv->mib[i]); priv->mib[i] = NULL;
priv->mib[i] = NULL; }
}
kfree(priv->mib); kfree(priv->mib);
priv->mib = NULL; priv->mib = NULL;
} }

View file

@ -860,12 +860,9 @@ static int allocate_buffers(struct strip *strip_info, int mtu)
strip_info->mtu = dev->mtu = mtu; strip_info->mtu = dev->mtu = mtu;
return (1); return (1);
} }
if (r) kfree(r);
kfree(r); kfree(s);
if (s) kfree(t);
kfree(s);
if (t)
kfree(t);
return (0); 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", printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
strip_info->dev->name, old_mtu, strip_info->mtu); strip_info->dev->name, old_mtu, strip_info->mtu);
if (orbuff) kfree(orbuff);
kfree(orbuff); kfree(osbuff);
if (osbuff) kfree(otbuff);
kfree(osbuff);
if (otbuff)
kfree(otbuff);
return 0; return 0;
} }
@ -2498,18 +2491,13 @@ static int strip_close_low(struct net_device *dev)
/* /*
* Free all STRIP frame buffers. * Free all STRIP frame buffers.
*/ */
if (strip_info->rx_buff) { kfree(strip_info->rx_buff);
kfree(strip_info->rx_buff); strip_info->rx_buff = NULL;
strip_info->rx_buff = NULL; kfree(strip_info->sx_buff);
} strip_info->sx_buff = NULL;
if (strip_info->sx_buff) { kfree(strip_info->tx_buff);
kfree(strip_info->sx_buff); strip_info->tx_buff = NULL;
strip_info->sx_buff = NULL;
}
if (strip_info->tx_buff) {
kfree(strip_info->tx_buff);
strip_info->tx_buff = NULL;
}
del_timer(&strip_info->idle_timer); del_timer(&strip_info->idle_timer);
return 0; return 0;
} }

View file

@ -237,8 +237,7 @@ typedef struct ax25_cb {
static __inline__ void ax25_cb_put(ax25_cb *ax25) static __inline__ void ax25_cb_put(ax25_cb *ax25)
{ {
if (atomic_dec_and_test(&ax25->refcount)) { if (atomic_dec_and_test(&ax25->refcount)) {
if (ax25->digipeat) kfree(ax25->digipeat);
kfree(ax25->digipeat);
kfree(ax25); kfree(ax25);
} }
} }

View 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) static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh)
{ {
if (atomic_dec_and_test(&nr_neigh->refcount)) { if (atomic_dec_and_test(&nr_neigh->refcount)) {
if (nr_neigh->digipeat != NULL) kfree(nr_neigh->digipeat);
kfree(nr_neigh->digipeat);
kfree(nr_neigh); kfree(nr_neigh);
} }
} }