diff options
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/sddr55.c | 24 |
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 | ||