cleanup not needed NULL checks before kfree, thanks to Jesper Juhl for the
hints
This commit is contained in:
parent
f285da122c
commit
0cc92c0d61
|
@ -133,18 +133,12 @@ mISDN_free_bch(bchannel_t *bch) {
|
|||
#endif
|
||||
discard_queue(&bch->rqueue);
|
||||
#endif
|
||||
if (bch->blog) {
|
||||
kfree(bch->blog);
|
||||
bch->blog = NULL;
|
||||
}
|
||||
if (bch->rx_buf) {
|
||||
kfree(bch->rx_buf);
|
||||
bch->rx_buf = NULL;
|
||||
}
|
||||
if (bch->tx_buf) {
|
||||
kfree(bch->tx_buf);
|
||||
bch->tx_buf = NULL;
|
||||
}
|
||||
kfree(bch->blog);
|
||||
bch->blog = NULL;
|
||||
kfree(bch->rx_buf);
|
||||
bch->rx_buf = NULL;
|
||||
kfree(bch->tx_buf);
|
||||
bch->tx_buf = NULL;
|
||||
if (bch->next_skb) {
|
||||
dev_kfree_skb(bch->next_skb);
|
||||
bch->next_skb = NULL;
|
||||
|
|
|
@ -103,18 +103,14 @@ mISDN_free_dch(dchannel_t *dch) {
|
|||
dev_kfree_skb(dch->rx_skb);
|
||||
dch->rx_skb = NULL;
|
||||
}
|
||||
if (dch->tx_buf) {
|
||||
kfree(dch->tx_buf);
|
||||
dch->tx_buf = NULL;
|
||||
}
|
||||
kfree(dch->tx_buf);
|
||||
dch->tx_buf = NULL;
|
||||
if (dch->next_skb) {
|
||||
dev_kfree_skb(dch->next_skb);
|
||||
dch->next_skb = NULL;
|
||||
}
|
||||
if (dch->dlog) {
|
||||
kfree(dch->dlog);
|
||||
dch->dlog = NULL;
|
||||
}
|
||||
kfree(dch->dlog);
|
||||
dch->dlog = NULL;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3130,10 +3130,8 @@ release_port(hfc_multi_t *hc, int port)
|
|||
kfree(hc->chan[i].dch);
|
||||
hc->chan[i].dch = NULL;
|
||||
}
|
||||
if (hc->chan[i].rx_buf) {
|
||||
kfree(hc->chan[i].rx_buf);
|
||||
hc->chan[i].rx_buf = NULL;
|
||||
}
|
||||
kfree(hc->chan[i].rx_buf);
|
||||
hc->chan[i].rx_buf = NULL;
|
||||
if (hc->chan[i].bch) {
|
||||
if (debug & DEBUG_HFCMULTI_INIT)
|
||||
printk(KERN_DEBUG "%s: free port %d B-channel %d (1..32)\n", __FUNCTION__, hc->chan[i].port, i);
|
||||
|
@ -3755,10 +3753,8 @@ static int __devinit hfcpci_probe(struct pci_dev *pdev, const struct pci_device_
|
|||
kfree(hc->chan[i].dch);
|
||||
hc->chan[i].dch = NULL;
|
||||
}
|
||||
if (hc->chan[i].rx_buf) {
|
||||
kfree(hc->chan[i].rx_buf);
|
||||
hc->chan[i].rx_buf = NULL;
|
||||
}
|
||||
kfree(hc->chan[i].rx_buf);
|
||||
hc->chan[i].rx_buf = NULL;
|
||||
if (hc->chan[i].bch) {
|
||||
if (debug & DEBUG_HFCMULTI_INIT)
|
||||
printk(KERN_DEBUG "%s: free B-channel %d (1..32)\n", __FUNCTION__, i);
|
||||
|
|
|
@ -722,14 +722,10 @@ mISDN_isac_free(dchannel_t *dch) {
|
|||
}
|
||||
if (!isac)
|
||||
return;
|
||||
if (isac->mon_rx) {
|
||||
kfree(isac->mon_rx);
|
||||
isac->mon_rx = NULL;
|
||||
}
|
||||
if (isac->mon_tx) {
|
||||
kfree(isac->mon_tx);
|
||||
isac->mon_tx = NULL;
|
||||
}
|
||||
kfree(isac->mon_rx);
|
||||
isac->mon_rx = NULL;
|
||||
kfree(isac->mon_tx);
|
||||
isac->mon_tx = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -397,8 +397,7 @@ do_clear_stack(mISDNstack_t *st) {
|
|||
|
||||
if (core_debug & DEBUG_CORE_FUNC)
|
||||
printk(KERN_DEBUG "%s: st(%08x)\n", __FUNCTION__, st->id);
|
||||
if (st->pid.pbuf)
|
||||
kfree(st->pid.pbuf);
|
||||
kfree(st->pid.pbuf);
|
||||
memset(&st->pid, 0, sizeof(mISDN_pid_t));
|
||||
memset(&st->para, 0, sizeof(mISDN_stPara_t));
|
||||
release_layers(st, MGR_UNREGLAYER | REQUEST);
|
||||
|
|
|
@ -443,8 +443,7 @@ create_layer(mISDNdevice_t *dev, struct sk_buff *skb)
|
|||
}
|
||||
copy_pid(pid, &inst->pid, pid->pbuf);
|
||||
ret = inst->obj->own_ctrl(st, MGR_NEWLAYER | REQUEST, pid);
|
||||
if (pid->pbuf)
|
||||
kfree(pid->pbuf);
|
||||
kfree(pid->pbuf);
|
||||
kfree(pid);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "%s: MGR_NEWLAYER | REQUEST for clone returns %d\n", __FUNCTION__, ret);
|
||||
|
|
|
@ -539,8 +539,7 @@ void
|
|||
X25_release_channel(x25_channel_t *l3c)
|
||||
{
|
||||
list_del(&l3c->list);
|
||||
if (l3c->ncpi_data)
|
||||
kfree(l3c->ncpi_data);
|
||||
kfree(l3c->ncpi_data);
|
||||
l3c->ncpi_data = NULL;
|
||||
l3c->ncpi_len = 0;
|
||||
discard_queue(&l3c->dataq);
|
||||
|
@ -548,10 +547,7 @@ X25_release_channel(x25_channel_t *l3c)
|
|||
mISDN_FsmDelTimer(&l3c->TD, 2);
|
||||
discard_queue(&l3c->dataq);
|
||||
discard_confq(l3c);
|
||||
if (l3c->confq) {
|
||||
kfree(l3c->confq);
|
||||
l3c->confq = NULL;
|
||||
}
|
||||
kfree(l3c->confq);
|
||||
kfree(l3c);
|
||||
}
|
||||
|
||||
|
@ -590,8 +586,7 @@ X25_realloc_ncpi_data(x25_channel_t *l3c, int len, u_char *data)
|
|||
{
|
||||
if (len) {
|
||||
if (len > l3c->ncpi_len) {
|
||||
if (l3c->ncpi_data)
|
||||
kfree(l3c->ncpi_data);
|
||||
kfree(l3c->ncpi_data);
|
||||
l3c->ncpi_data = kmalloc(len, GFP_ATOMIC);
|
||||
if (!l3c->ncpi_data) {
|
||||
l3c->ncpi_len = 0;
|
||||
|
@ -599,7 +594,7 @@ X25_realloc_ncpi_data(x25_channel_t *l3c, int len, u_char *data)
|
|||
}
|
||||
}
|
||||
memcpy(l3c->ncpi_data, data, len);
|
||||
} else if (l3c->ncpi_data) {
|
||||
} else {
|
||||
kfree(l3c->ncpi_data);
|
||||
l3c->ncpi_data = NULL;
|
||||
}
|
||||
|
@ -631,8 +626,7 @@ new_x25_channel(x25_l3_t *l3, x25_channel_t **ch_p, __u16 ch, int dlen, u_char *
|
|||
l3c->confq = kmalloc(l3c->lwin * sizeof(x25_ConfQueue_t), GFP_ATOMIC);
|
||||
if (!l3c->confq) {
|
||||
printk(KERN_ERR "kmalloc confq %d entries failed\n", l3c->lwin);
|
||||
if (l3c->ncpi_data)
|
||||
kfree(l3c->ncpi_data);
|
||||
kfree(l3c->ncpi_data);
|
||||
kfree(l3c);
|
||||
return(-ENOMEM);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue