Commit a2c1aa54 authored by Jesper Juhl's avatar Jesper Juhl Committed by David S. Miller

[ATM]: [drivers] kill pointless NULL checks and casts before kfree()

Signed-off-by: default avatarJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: default avatarChas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3087e1ff
...@@ -383,7 +383,6 @@ fore200e_shutdown(struct fore200e* fore200e) ...@@ -383,7 +383,6 @@ fore200e_shutdown(struct fore200e* fore200e)
switch(fore200e->state) { switch(fore200e->state) {
case FORE200E_STATE_COMPLETE: case FORE200E_STATE_COMPLETE:
if (fore200e->stats)
kfree(fore200e->stats); kfree(fore200e->stats);
case FORE200E_STATE_IRQ: case FORE200E_STATE_IRQ:
...@@ -963,7 +962,6 @@ fore200e_tx_irq(struct fore200e* fore200e) ...@@ -963,7 +962,6 @@ fore200e_tx_irq(struct fore200e* fore200e)
entry, txq->tail, entry->vc_map, entry->skb); entry, txq->tail, entry->vc_map, entry->skb);
/* free copy of misaligned data */ /* free copy of misaligned data */
if (entry->data)
kfree(entry->data); kfree(entry->data);
/* remove DMA mapping */ /* remove DMA mapping */
......
...@@ -412,7 +412,6 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) ...@@ -412,7 +412,6 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
init_one_failure: init_one_failure:
if (atm_dev) if (atm_dev)
atm_dev_deregister(atm_dev); atm_dev_deregister(atm_dev);
if (he_dev)
kfree(he_dev); kfree(he_dev);
pci_disable_device(pci_dev); pci_disable_device(pci_dev);
return err; return err;
...@@ -2534,7 +2533,6 @@ he_open(struct atm_vcc *vcc) ...@@ -2534,7 +2533,6 @@ he_open(struct atm_vcc *vcc)
open_failed: open_failed:
if (err) { if (err) {
if (he_vcc)
kfree(he_vcc); kfree(he_vcc);
clear_bit(ATM_VF_ADDR, &vcc->flags); clear_bit(ATM_VF_ADDR, &vcc->flags);
} }
......
...@@ -676,10 +676,10 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev) ...@@ -676,10 +676,10 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
PRINTK("nicstar%d: RSQ base at 0x%x.\n", i, (u32) card->rsq.base); PRINTK("nicstar%d: RSQ base at 0x%x.\n", i, (u32) card->rsq.base);
/* Initialize SCQ0, the only VBR SCQ used */ /* Initialize SCQ0, the only VBR SCQ used */
card->scq1 = (scq_info *) NULL; card->scq1 = NULL;
card->scq2 = (scq_info *) NULL; card->scq2 = NULL;
card->scq0 = get_scq(VBR_SCQSIZE, NS_VRSCD0); card->scq0 = get_scq(VBR_SCQSIZE, NS_VRSCD0);
if (card->scq0 == (scq_info *) NULL) if (card->scq0 == NULL)
{ {
printk("nicstar%d: can't get SCQ0.\n", i); printk("nicstar%d: can't get SCQ0.\n", i);
error = 12; error = 12;
...@@ -993,24 +993,24 @@ static scq_info *get_scq(int size, u32 scd) ...@@ -993,24 +993,24 @@ static scq_info *get_scq(int size, u32 scd)
int i; int i;
if (size != VBR_SCQSIZE && size != CBR_SCQSIZE) if (size != VBR_SCQSIZE && size != CBR_SCQSIZE)
return (scq_info *) NULL; return NULL;
scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL); scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL);
if (scq == (scq_info *) NULL) if (scq == NULL)
return (scq_info *) NULL; return NULL;
scq->org = kmalloc(2 * size, GFP_KERNEL); scq->org = kmalloc(2 * size, GFP_KERNEL);
if (scq->org == NULL) if (scq->org == NULL)
{ {
kfree(scq); kfree(scq);
return (scq_info *) NULL; return NULL;
} }
scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) * scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) *
(size / NS_SCQE_SIZE), GFP_KERNEL); (size / NS_SCQE_SIZE), GFP_KERNEL);
if (scq->skb == (struct sk_buff **) NULL) if (scq->skb == NULL)
{ {
kfree(scq->org); kfree(scq->org);
kfree(scq); kfree(scq);
return (scq_info *) NULL; return NULL;
} }
scq->num_entries = size / NS_SCQE_SIZE; scq->num_entries = size / NS_SCQE_SIZE;
scq->base = (ns_scqe *) ALIGN_ADDRESS(scq->org, size); scq->base = (ns_scqe *) ALIGN_ADDRESS(scq->org, size);
...@@ -1498,7 +1498,7 @@ static int ns_open(struct atm_vcc *vcc) ...@@ -1498,7 +1498,7 @@ static int ns_open(struct atm_vcc *vcc)
vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE; vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE;
scq = get_scq(CBR_SCQSIZE, vc->cbr_scd); scq = get_scq(CBR_SCQSIZE, vc->cbr_scd);
if (scq == (scq_info *) NULL) if (scq == NULL)
{ {
PRINTK("nicstar%d: can't get fixed rate SCQ.\n", card->index); PRINTK("nicstar%d: can't get fixed rate SCQ.\n", card->index);
card->scd2vc[frscdi] = NULL; card->scd2vc[frscdi] = NULL;
......
...@@ -902,7 +902,7 @@ static void close_tx(struct atm_vcc *vcc) ...@@ -902,7 +902,7 @@ static void close_tx(struct atm_vcc *vcc)
zatm_dev->tx_bw += vcc->qos.txtp.min_pcr; zatm_dev->tx_bw += vcc->qos.txtp.min_pcr;
dealloc_shaper(vcc->dev,zatm_vcc->shaper); dealloc_shaper(vcc->dev,zatm_vcc->shaper);
} }
if (zatm_vcc->ring) kfree(zatm_vcc->ring); kfree(zatm_vcc->ring);
} }
...@@ -1339,11 +1339,8 @@ static int __init zatm_start(struct atm_dev *dev) ...@@ -1339,11 +1339,8 @@ static int __init zatm_start(struct atm_dev *dev)
return 0; return 0;
out: out:
for (i = 0; i < NR_MBX; i++) for (i = 0; i < NR_MBX; i++)
if (zatm_dev->mbx_start[i] != 0) kfree(zatm_dev->mbx_start[i]);
kfree((void *) zatm_dev->mbx_start[i]);
if (zatm_dev->rx_map != NULL)
kfree(zatm_dev->rx_map); kfree(zatm_dev->rx_map);
if (zatm_dev->tx_map != NULL)
kfree(zatm_dev->tx_map); kfree(zatm_dev->tx_map);
free_irq(zatm_dev->irq, dev); free_irq(zatm_dev->irq, dev);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment