X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fstorage%2Fsddr55.c;h=0b1b5b59ca7b6d2423a002a143ef3cf2f1f207a5;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=10270f42a658edcd13fac19ee078a22e14ea0020;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 10270f42a..0b1b5b59c 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c @@ -31,9 +31,9 @@ #include #include +#include "usb.h" #include "transport.h" #include "protocol.h" -#include "usb.h" #include "debug.h" #include "sddr55.h" @@ -119,10 +119,8 @@ static int sddr55_status(struct us_data *us) /* expect to get short transfer if no card fitted */ if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { /* had a short transfer, no card inserted, free map memory */ - if (info->lba_to_pba) - kfree(info->lba_to_pba); - if (info->pba_to_lba) - kfree(info->pba_to_lba); + kfree(info->lba_to_pba); + kfree(info->pba_to_lba); info->lba_to_pba = NULL; info->pba_to_lba = NULL; @@ -649,18 +647,14 @@ static int sddr55_read_map(struct us_data *us) { return -1; } - if (info->lba_to_pba) - kfree(info->lba_to_pba); - if (info->pba_to_lba) - kfree(info->pba_to_lba); + kfree(info->lba_to_pba); + kfree(info->pba_to_lba); info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { - if (info->lba_to_pba != NULL) - kfree(info->lba_to_pba); - if (info->pba_to_lba != NULL) - kfree(info->pba_to_lba); + kfree(info->lba_to_pba); + kfree(info->pba_to_lba); info->lba_to_pba = NULL; info->pba_to_lba = NULL; kfree(buffer); @@ -728,10 +722,8 @@ static void sddr55_card_info_destructor(void *extra) { if (!extra) return; - if (info->lba_to_pba) - kfree(info->lba_to_pba); - if (info->pba_to_lba) - kfree(info->pba_to_lba); + kfree(info->lba_to_pba); + kfree(info->pba_to_lba); } @@ -759,11 +751,10 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) struct sddr55_card_info *info; if (!us->extra) { - us->extra = kmalloc( + us->extra = kzalloc( sizeof(struct sddr55_card_info), GFP_NOIO); if (!us->extra) return USB_STOR_TRANSPORT_ERROR; - memset(us->extra, 0, sizeof(struct sddr55_card_info)); us->extra_destructor = sddr55_card_info_destructor; }