forked from Minki/linux
[PATCH] kfree cleanup: drivers/isdn
This is the drivers/isdn/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in drivers/isdn/. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
735d5661d5
commit
3c7208f253
@ -212,11 +212,8 @@ static void avmcs_detach(dev_link_t *link)
|
||||
|
||||
/* Unlink device structure, free pieces */
|
||||
*linkp = link->next;
|
||||
if (link->priv) {
|
||||
kfree(link->priv);
|
||||
}
|
||||
kfree(link);
|
||||
|
||||
} /* avmcs_detach */
|
||||
|
||||
/*======================================================================
|
||||
|
@ -552,14 +552,10 @@ close_hdlcstate(struct BCState *bcs)
|
||||
{
|
||||
modehdlc(bcs, 0, 0);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.hdlc.rcvbuf) {
|
||||
kfree(bcs->hw.hdlc.rcvbuf);
|
||||
bcs->hw.hdlc.rcvbuf = NULL;
|
||||
}
|
||||
if (bcs->blog) {
|
||||
kfree(bcs->blog);
|
||||
bcs->blog = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
|
@ -236,9 +236,7 @@ static void avma1cs_detach(dev_link_t *link)
|
||||
|
||||
/* Unlink device structure, free pieces */
|
||||
*linkp = link->next;
|
||||
if (link->priv) {
|
||||
kfree(link->priv);
|
||||
}
|
||||
kfree(link);
|
||||
|
||||
} /* avma1cs_detach */
|
||||
|
@ -787,7 +787,6 @@ static void ll_unload(struct IsdnCardState *cs)
|
||||
ic.command = ISDN_STAT_UNLOAD;
|
||||
ic.driver = cs->myid;
|
||||
cs->iif.statcallb(&ic);
|
||||
if (cs->status_buf)
|
||||
kfree(cs->status_buf);
|
||||
cs->status_read = NULL;
|
||||
cs->status_write = NULL;
|
||||
@ -807,10 +806,8 @@ static void closecard(int cardnr)
|
||||
|
||||
skb_queue_purge(&csta->rq);
|
||||
skb_queue_purge(&csta->sq);
|
||||
if (csta->rcvbuf) {
|
||||
kfree(csta->rcvbuf);
|
||||
csta->rcvbuf = NULL;
|
||||
}
|
||||
if (csta->tx_skb) {
|
||||
dev_kfree_skb(csta->tx_skb);
|
||||
csta->tx_skb = NULL;
|
||||
|
@ -1052,19 +1052,13 @@ init2bds0(struct IsdnCardState *cs)
|
||||
void
|
||||
release2bds0(struct IsdnCardState *cs)
|
||||
{
|
||||
if (cs->bcs[0].hw.hfc.send) {
|
||||
kfree(cs->bcs[0].hw.hfc.send);
|
||||
cs->bcs[0].hw.hfc.send = NULL;
|
||||
}
|
||||
if (cs->bcs[1].hw.hfc.send) {
|
||||
kfree(cs->bcs[1].hw.hfc.send);
|
||||
cs->bcs[1].hw.hfc.send = NULL;
|
||||
}
|
||||
if (cs->hw.hfcD.send) {
|
||||
kfree(cs->hw.hfcD.send);
|
||||
cs->hw.hfcD.send = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
set_cs_func(struct IsdnCardState *cs)
|
||||
|
@ -582,12 +582,8 @@ inithfc(struct IsdnCardState *cs)
|
||||
void
|
||||
releasehfc(struct IsdnCardState *cs)
|
||||
{
|
||||
if (cs->bcs[0].hw.hfc.send) {
|
||||
kfree(cs->bcs[0].hw.hfc.send);
|
||||
cs->bcs[0].hw.hfc.send = NULL;
|
||||
}
|
||||
if (cs->bcs[1].hw.hfc.send) {
|
||||
kfree(cs->bcs[1].hw.hfc.send);
|
||||
cs->bcs[1].hw.hfc.send = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -156,14 +156,10 @@ close_hscxstate(struct BCState *bcs)
|
||||
{
|
||||
modehscx(bcs, 0, bcs->channel);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.hscx.rcvbuf) {
|
||||
kfree(bcs->hw.hscx.rcvbuf);
|
||||
bcs->hw.hscx.rcvbuf = NULL;
|
||||
}
|
||||
if (bcs->blog) {
|
||||
kfree(bcs->blog);
|
||||
bcs->blog = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
|
@ -571,15 +571,11 @@ setstack_icc(struct PStack *st, struct IsdnCardState *cs)
|
||||
|
||||
static void
|
||||
DC_Close_icc(struct IsdnCardState *cs) {
|
||||
if (cs->dc.icc.mon_rx) {
|
||||
kfree(cs->dc.icc.mon_rx);
|
||||
cs->dc.icc.mon_rx = NULL;
|
||||
}
|
||||
if (cs->dc.icc.mon_tx) {
|
||||
kfree(cs->dc.icc.mon_tx);
|
||||
cs->dc.icc.mon_tx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dbusy_timer_handler(struct IsdnCardState *cs)
|
||||
|
@ -762,14 +762,10 @@ bch_close_state(struct BCState *bcs)
|
||||
{
|
||||
bch_mode(bcs, 0, bcs->channel);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.hscx.rcvbuf) {
|
||||
kfree(bcs->hw.hscx.rcvbuf);
|
||||
bcs->hw.hscx.rcvbuf = NULL;
|
||||
}
|
||||
if (bcs->blog) {
|
||||
kfree(bcs->blog);
|
||||
bcs->blog = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
|
@ -570,16 +570,13 @@ setstack_isac(struct PStack *st, struct IsdnCardState *cs)
|
||||
}
|
||||
|
||||
static void
|
||||
DC_Close_isac(struct IsdnCardState *cs) {
|
||||
if (cs->dc.isac.mon_rx) {
|
||||
DC_Close_isac(struct IsdnCardState *cs)
|
||||
{
|
||||
kfree(cs->dc.isac.mon_rx);
|
||||
cs->dc.isac.mon_rx = NULL;
|
||||
}
|
||||
if (cs->dc.isac.mon_tx) {
|
||||
kfree(cs->dc.isac.mon_tx);
|
||||
cs->dc.isac.mon_tx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dbusy_timer_handler(struct IsdnCardState *cs)
|
||||
|
@ -1688,10 +1688,8 @@ close_isarstate(struct BCState *bcs)
|
||||
{
|
||||
modeisar(bcs, 0, bcs->channel);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.isar.rcvbuf) {
|
||||
kfree(bcs->hw.isar.rcvbuf);
|
||||
bcs->hw.isar.rcvbuf = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
|
@ -195,14 +195,10 @@ close_jadestate(struct BCState *bcs)
|
||||
{
|
||||
modejade(bcs, 0, bcs->channel);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.hscx.rcvbuf) {
|
||||
kfree(bcs->hw.hscx.rcvbuf);
|
||||
bcs->hw.hscx.rcvbuf = NULL;
|
||||
}
|
||||
if (bcs->blog) {
|
||||
kfree(bcs->blog);
|
||||
bcs->blog = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
|
@ -855,14 +855,10 @@ close_tigerstate(struct BCState *bcs)
|
||||
{
|
||||
mode_tiger(bcs, 0, bcs->channel);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.tiger.rcvbuf) {
|
||||
kfree(bcs->hw.tiger.rcvbuf);
|
||||
bcs->hw.tiger.rcvbuf = NULL;
|
||||
}
|
||||
if (bcs->hw.tiger.sendbuf) {
|
||||
kfree(bcs->hw.tiger.sendbuf);
|
||||
bcs->hw.tiger.sendbuf = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
@ -967,21 +963,13 @@ inittiger(struct IsdnCardState *cs)
|
||||
static void
|
||||
releasetiger(struct IsdnCardState *cs)
|
||||
{
|
||||
if (cs->bcs[0].hw.tiger.send) {
|
||||
kfree(cs->bcs[0].hw.tiger.send);
|
||||
cs->bcs[0].hw.tiger.send = NULL;
|
||||
}
|
||||
if (cs->bcs[1].hw.tiger.send) {
|
||||
cs->bcs[1].hw.tiger.send = NULL;
|
||||
}
|
||||
if (cs->bcs[0].hw.tiger.rec) {
|
||||
kfree(cs->bcs[0].hw.tiger.rec);
|
||||
cs->bcs[0].hw.tiger.rec = NULL;
|
||||
}
|
||||
if (cs->bcs[1].hw.tiger.rec) {
|
||||
cs->bcs[1].hw.tiger.rec = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
release_io_netjet(struct IsdnCardState *cs)
|
||||
|
@ -335,13 +335,11 @@ void st5481_release_usb(struct st5481_adapter *adapter)
|
||||
|
||||
// Stop and free Control and Interrupt URBs
|
||||
usb_kill_urb(ctrl->urb);
|
||||
if (ctrl->urb->transfer_buffer)
|
||||
kfree(ctrl->urb->transfer_buffer);
|
||||
usb_free_urb(ctrl->urb);
|
||||
ctrl->urb = NULL;
|
||||
|
||||
usb_kill_urb(intr->urb);
|
||||
if (intr->urb->transfer_buffer)
|
||||
kfree(intr->urb->transfer_buffer);
|
||||
usb_free_urb(intr->urb);
|
||||
ctrl->urb = NULL;
|
||||
@ -457,7 +455,6 @@ st5481_setup_isocpipes(struct urb* urb[2], struct usb_device *dev,
|
||||
err:
|
||||
for (j = 0; j < 2; j++) {
|
||||
if (urb[j]) {
|
||||
if (urb[j]->transfer_buffer)
|
||||
kfree(urb[j]->transfer_buffer);
|
||||
urb[j]->transfer_buffer = NULL;
|
||||
usb_free_urb(urb[j]);
|
||||
@ -473,7 +470,6 @@ void st5481_release_isocpipes(struct urb* urb[2])
|
||||
|
||||
for (j = 0; j < 2; j++) {
|
||||
usb_kill_urb(urb[j]);
|
||||
if (urb[j]->transfer_buffer)
|
||||
kfree(urb[j]->transfer_buffer);
|
||||
usb_free_urb(urb[j]);
|
||||
urb[j] = NULL;
|
||||
|
@ -819,14 +819,10 @@ close_w6692state(struct BCState *bcs)
|
||||
{
|
||||
W6692Bmode(bcs, 0, bcs->channel);
|
||||
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
|
||||
if (bcs->hw.w6692.rcvbuf) {
|
||||
kfree(bcs->hw.w6692.rcvbuf);
|
||||
bcs->hw.w6692.rcvbuf = NULL;
|
||||
}
|
||||
if (bcs->blog) {
|
||||
kfree(bcs->blog);
|
||||
bcs->blog = NULL;
|
||||
}
|
||||
skb_queue_purge(&bcs->rqueue);
|
||||
skb_queue_purge(&bcs->squeue);
|
||||
if (bcs->tx_skb) {
|
||||
|
@ -359,7 +359,6 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
|
||||
} else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
|
||||
/* read access -> output card info data */
|
||||
|
||||
if (filep->private_data)
|
||||
kfree(filep->private_data); /* release memory */
|
||||
}
|
||||
unlock_kernel();
|
||||
|
@ -364,11 +364,9 @@ isdn_ppp_release(int min, struct file *file)
|
||||
isdn_net_hangup(&p->dev);
|
||||
}
|
||||
for (i = 0; i < NUM_RCV_BUFFS; i++) {
|
||||
if (is->rq[i].buf) {
|
||||
kfree(is->rq[i].buf);
|
||||
is->rq[i].buf = NULL;
|
||||
}
|
||||
}
|
||||
is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */
|
||||
is->last = is->rq;
|
||||
|
||||
@ -378,14 +376,10 @@ isdn_ppp_release(int min, struct file *file)
|
||||
is->slcomp = NULL;
|
||||
#endif
|
||||
#ifdef CONFIG_IPPP_FILTER
|
||||
if (is->pass_filter) {
|
||||
kfree(is->pass_filter);
|
||||
is->pass_filter = NULL;
|
||||
}
|
||||
if (is->active_filter) {
|
||||
kfree(is->active_filter);
|
||||
is->active_filter = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TODO: if this was the previous master: link the stuff to the new master */
|
||||
@ -914,7 +908,6 @@ isdn_ppp_cleanup(void)
|
||||
kfree(ippp_table[i]);
|
||||
|
||||
#ifdef CONFIG_ISDN_MPP
|
||||
if (isdn_ppp_bundle_arr)
|
||||
kfree(isdn_ppp_bundle_arr);
|
||||
#endif /* CONFIG_ISDN_MPP */
|
||||
|
||||
|
@ -712,22 +712,14 @@ isdn_tty_modem_hup(modem_info * info, int local)
|
||||
#endif
|
||||
info->emu.vpar[4] = 0;
|
||||
info->emu.vpar[5] = 8;
|
||||
if (info->dtmf_state) {
|
||||
kfree(info->dtmf_state);
|
||||
info->dtmf_state = NULL;
|
||||
}
|
||||
if (info->silence_state) {
|
||||
kfree(info->silence_state);
|
||||
info->silence_state = NULL;
|
||||
}
|
||||
if (info->adpcms) {
|
||||
kfree(info->adpcms);
|
||||
info->adpcms = NULL;
|
||||
}
|
||||
if (info->adpcmr) {
|
||||
kfree(info->adpcmr);
|
||||
info->adpcmr = NULL;
|
||||
}
|
||||
#endif
|
||||
if ((info->msr & UART_MSR_RI) &&
|
||||
(info->emu.mdmreg[REG_RUNG] & BIT_RUNG))
|
||||
|
@ -561,9 +561,7 @@ void pcbit_l3_receive(struct pcbit_dev * dev, ulong msg,
|
||||
else
|
||||
pcbit_fsm_event(dev, chan, EV_USR_RELEASE_REQ, NULL);
|
||||
|
||||
if (cbdata.data.setup.CalledPN)
|
||||
kfree(cbdata.data.setup.CalledPN);
|
||||
if (cbdata.data.setup.CallingPN)
|
||||
kfree(cbdata.data.setup.CallingPN);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user