aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorJesper Juhl <juhl-lkml@dif.dk>2005-06-02 16:04:07 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-02 16:04:07 -0400
commita2c1aa54746bace5d03cc66521fbf3bb6fb2f916 (patch)
tree9f9e535060b9a9690c432845a9c6ee3929bef9b2 /drivers/atm
parent3087e1ff8d64da7b6b527e89d0c0864ab36294b8 (diff)
[ATM]: [drivers] kill pointless NULL checks and casts before kfree()
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/fore200e.c6
-rw-r--r--drivers/atm/he.c6
-rw-r--r--drivers/atm/nicstar.c20
-rw-r--r--drivers/atm/zatm.c11
4 files changed, 18 insertions, 25 deletions
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 9e65bfb85ba3..5f702199543a 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -383,8 +383,7 @@ fore200e_shutdown(struct fore200e* fore200e)
383 switch(fore200e->state) { 383 switch(fore200e->state) {
384 384
385 case FORE200E_STATE_COMPLETE: 385 case FORE200E_STATE_COMPLETE:
386 if (fore200e->stats) 386 kfree(fore200e->stats);
387 kfree(fore200e->stats);
388 387
389 case FORE200E_STATE_IRQ: 388 case FORE200E_STATE_IRQ:
390 free_irq(fore200e->irq, fore200e->atm_dev); 389 free_irq(fore200e->irq, fore200e->atm_dev);
@@ -963,8 +962,7 @@ fore200e_tx_irq(struct fore200e* fore200e)
963 entry, txq->tail, entry->vc_map, entry->skb); 962 entry, txq->tail, entry->vc_map, entry->skb);
964 963
965 /* free copy of misaligned data */ 964 /* free copy of misaligned data */
966 if (entry->data) 965 kfree(entry->data);
967 kfree(entry->data);
968 966
969 /* remove DMA mapping */ 967 /* remove DMA mapping */
970 fore200e->bus->dma_unmap(fore200e, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length, 968 fore200e->bus->dma_unmap(fore200e, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length,
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 3022c548a132..df2c83fd5496 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -412,8 +412,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
412init_one_failure: 412init_one_failure:
413 if (atm_dev) 413 if (atm_dev)
414 atm_dev_deregister(atm_dev); 414 atm_dev_deregister(atm_dev);
415 if (he_dev) 415 kfree(he_dev);
416 kfree(he_dev);
417 pci_disable_device(pci_dev); 416 pci_disable_device(pci_dev);
418 return err; 417 return err;
419} 418}
@@ -2534,8 +2533,7 @@ he_open(struct atm_vcc *vcc)
2534open_failed: 2533open_failed:
2535 2534
2536 if (err) { 2535 if (err) {
2537 if (he_vcc) 2536 kfree(he_vcc);
2538 kfree(he_vcc);
2539 clear_bit(ATM_VF_ADDR, &vcc->flags); 2537 clear_bit(ATM_VF_ADDR, &vcc->flags);
2540 } 2538 }
2541 else 2539 else
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 85bf5c8442b0..b2a7b754fd14 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -676,10 +676,10 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
676 PRINTK("nicstar%d: RSQ base at 0x%x.\n", i, (u32) card->rsq.base); 676 PRINTK("nicstar%d: RSQ base at 0x%x.\n", i, (u32) card->rsq.base);
677 677
678 /* Initialize SCQ0, the only VBR SCQ used */ 678 /* Initialize SCQ0, the only VBR SCQ used */
679 card->scq1 = (scq_info *) NULL; 679 card->scq1 = NULL;
680 card->scq2 = (scq_info *) NULL; 680 card->scq2 = NULL;
681 card->scq0 = get_scq(VBR_SCQSIZE, NS_VRSCD0); 681 card->scq0 = get_scq(VBR_SCQSIZE, NS_VRSCD0);
682 if (card->scq0 == (scq_info *) NULL) 682 if (card->scq0 == NULL)
683 { 683 {
684 printk("nicstar%d: can't get SCQ0.\n", i); 684 printk("nicstar%d: can't get SCQ0.\n", i);
685 error = 12; 685 error = 12;
@@ -993,24 +993,24 @@ static scq_info *get_scq(int size, u32 scd)
993 int i; 993 int i;
994 994
995 if (size != VBR_SCQSIZE && size != CBR_SCQSIZE) 995 if (size != VBR_SCQSIZE && size != CBR_SCQSIZE)
996 return (scq_info *) NULL; 996 return NULL;
997 997
998 scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL); 998 scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL);
999 if (scq == (scq_info *) NULL) 999 if (scq == NULL)
1000 return (scq_info *) NULL; 1000 return NULL;
1001 scq->org = kmalloc(2 * size, GFP_KERNEL); 1001 scq->org = kmalloc(2 * size, GFP_KERNEL);
1002 if (scq->org == NULL) 1002 if (scq->org == NULL)
1003 { 1003 {
1004 kfree(scq); 1004 kfree(scq);
1005 return (scq_info *) NULL; 1005 return NULL;
1006 } 1006 }
1007 scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) * 1007 scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) *
1008 (size / NS_SCQE_SIZE), GFP_KERNEL); 1008 (size / NS_SCQE_SIZE), GFP_KERNEL);
1009 if (scq->skb == (struct sk_buff **) NULL) 1009 if (scq->skb == NULL)
1010 { 1010 {
1011 kfree(scq->org); 1011 kfree(scq->org);
1012 kfree(scq); 1012 kfree(scq);
1013 return (scq_info *) NULL; 1013 return NULL;
1014 } 1014 }
1015 scq->num_entries = size / NS_SCQE_SIZE; 1015 scq->num_entries = size / NS_SCQE_SIZE;
1016 scq->base = (ns_scqe *) ALIGN_ADDRESS(scq->org, size); 1016 scq->base = (ns_scqe *) ALIGN_ADDRESS(scq->org, size);
@@ -1498,7 +1498,7 @@ static int ns_open(struct atm_vcc *vcc)
1498 vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE; 1498 vc->cbr_scd = NS_FRSCD + frscdi * NS_FRSCD_SIZE;
1499 1499
1500 scq = get_scq(CBR_SCQSIZE, vc->cbr_scd); 1500 scq = get_scq(CBR_SCQSIZE, vc->cbr_scd);
1501 if (scq == (scq_info *) NULL) 1501 if (scq == NULL)
1502 { 1502 {
1503 PRINTK("nicstar%d: can't get fixed rate SCQ.\n", card->index); 1503 PRINTK("nicstar%d: can't get fixed rate SCQ.\n", card->index);
1504 card->scd2vc[frscdi] = NULL; 1504 card->scd2vc[frscdi] = NULL;
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 47a800519ad0..8d5e65cb9755 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -902,7 +902,7 @@ static void close_tx(struct atm_vcc *vcc)
902 zatm_dev->tx_bw += vcc->qos.txtp.min_pcr; 902 zatm_dev->tx_bw += vcc->qos.txtp.min_pcr;
903 dealloc_shaper(vcc->dev,zatm_vcc->shaper); 903 dealloc_shaper(vcc->dev,zatm_vcc->shaper);
904 } 904 }
905 if (zatm_vcc->ring) kfree(zatm_vcc->ring); 905 kfree(zatm_vcc->ring);
906} 906}
907 907
908 908
@@ -1339,12 +1339,9 @@ static int __init zatm_start(struct atm_dev *dev)
1339 return 0; 1339 return 0;
1340 out: 1340 out:
1341 for (i = 0; i < NR_MBX; i++) 1341 for (i = 0; i < NR_MBX; i++)
1342 if (zatm_dev->mbx_start[i] != 0) 1342 kfree(zatm_dev->mbx_start[i]);
1343 kfree((void *) zatm_dev->mbx_start[i]); 1343 kfree(zatm_dev->rx_map);
1344 if (zatm_dev->rx_map != NULL) 1344 kfree(zatm_dev->tx_map);
1345 kfree(zatm_dev->rx_map);
1346 if (zatm_dev->tx_map != NULL)
1347 kfree(zatm_dev->tx_map);
1348 free_irq(zatm_dev->irq, dev); 1345 free_irq(zatm_dev->irq, dev);
1349 return error; 1346 return error;
1350} 1347}