aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/sddr55.c
diff options
context:
space:
mode:
authorJesper Juhl <juhl-lkml@dif.dk>2005-04-18 20:39:34 -0400
committerGreg K-H <gregkh@suse.de>2005-04-18 20:39:34 -0400
commit1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f (patch)
tree0bc14ec53acf3b4c08a9995c7ea335e236435558 /drivers/usb/storage/sddr55.c
parent6fd19f4b55f7fd1c9d8650bd7f8df2c81b69c5ca (diff)
[PATCH] USB: kfree cleanup for drivers/usb/* - no need to check for NULL
Get rid of a bunch of redundant NULL pointer checks in drivers/usb/*, there's no need to check a pointer for NULL before calling kfree() on it. Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/usb/class/audio.c ===================================================================
Diffstat (limited to 'drivers/usb/storage/sddr55.c')
-rw-r--r--drivers/usb/storage/sddr55.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 229ca181716b..8451779f4269 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -119,10 +119,8 @@ static int sddr55_status(struct us_data *us)
119 /* expect to get short transfer if no card fitted */ 119 /* expect to get short transfer if no card fitted */
120 if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { 120 if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
121 /* had a short transfer, no card inserted, free map memory */ 121 /* had a short transfer, no card inserted, free map memory */
122 if (info->lba_to_pba) 122 kfree(info->lba_to_pba);
123 kfree(info->lba_to_pba); 123 kfree(info->pba_to_lba);
124 if (info->pba_to_lba)
125 kfree(info->pba_to_lba);
126 info->lba_to_pba = NULL; 124 info->lba_to_pba = NULL;
127 info->pba_to_lba = NULL; 125 info->pba_to_lba = NULL;
128 126
@@ -649,18 +647,14 @@ static int sddr55_read_map(struct us_data *us) {
649 return -1; 647 return -1;
650 } 648 }
651 649
652 if (info->lba_to_pba) 650 kfree(info->lba_to_pba);
653 kfree(info->lba_to_pba); 651 kfree(info->pba_to_lba);
654 if (info->pba_to_lba)
655 kfree(info->pba_to_lba);
656 info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); 652 info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
657 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); 653 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
658 654
659 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { 655 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
660 if (info->lba_to_pba != NULL) 656 kfree(info->lba_to_pba);
661 kfree(info->lba_to_pba); 657 kfree(info->pba_to_lba);
662 if (info->pba_to_lba != NULL)
663 kfree(info->pba_to_lba);
664 info->lba_to_pba = NULL; 658 info->lba_to_pba = NULL;
665 info->pba_to_lba = NULL; 659 info->pba_to_lba = NULL;
666 kfree(buffer); 660 kfree(buffer);
@@ -728,10 +722,8 @@ static void sddr55_card_info_destructor(void *extra) {
728 if (!extra) 722 if (!extra)
729 return; 723 return;
730 724
731 if (info->lba_to_pba) 725 kfree(info->lba_to_pba);
732 kfree(info->lba_to_pba); 726 kfree(info->pba_to_lba);
733 if (info->pba_to_lba)
734 kfree(info->pba_to_lba);
735} 727}
736 728
737 729