Commit 887c2560 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: kzalloc for storage

another one for kzalloc. This covers the storage subdirectory.
Signed-off-by: default avatarOliver Neukum <oliver@neukum.name>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9ff87d73
...@@ -512,13 +512,12 @@ int datafab_transport(struct scsi_cmnd * srb, struct us_data *us) ...@@ -512,13 +512,12 @@ int datafab_transport(struct scsi_cmnd * srb, struct us_data *us)
}; };
if (!us->extra) { if (!us->extra) {
us->extra = kmalloc(sizeof(struct datafab_info), GFP_NOIO); us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO);
if (!us->extra) { if (!us->extra) {
US_DEBUGP("datafab_transport: Gah! " US_DEBUGP("datafab_transport: Gah! "
"Can't allocate storage for Datafab info struct!\n"); "Can't allocate storage for Datafab info struct!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
memset(us->extra, 0, sizeof(struct datafab_info));
us->extra_destructor = datafab_info_destructor; us->extra_destructor = datafab_info_destructor;
((struct datafab_info *)us->extra)->lun = -1; ((struct datafab_info *)us->extra)->lun = -1;
} }
......
...@@ -1361,21 +1361,19 @@ static int isd200_init_info(struct us_data *us) ...@@ -1361,21 +1361,19 @@ static int isd200_init_info(struct us_data *us)
struct isd200_info *info; struct isd200_info *info;
info = (struct isd200_info *) info = (struct isd200_info *)
kmalloc(sizeof(struct isd200_info), GFP_KERNEL); kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
if (!info) if (!info)
retStatus = ISD200_ERROR; retStatus = ISD200_ERROR;
else { else {
memset(info, 0, sizeof(struct isd200_info));
info->id = (struct hd_driveid *) info->id = (struct hd_driveid *)
kmalloc(sizeof(struct hd_driveid), GFP_KERNEL); kzalloc(sizeof(struct hd_driveid), GFP_KERNEL);
info->RegsBuf = (unsigned char *) info->RegsBuf = (unsigned char *)
kmalloc(sizeof(info->ATARegs), GFP_KERNEL); kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
if (!info->id || !info->RegsBuf) { if (!info->id || !info->RegsBuf) {
isd200_free_info_ptrs(info); isd200_free_info_ptrs(info);
kfree(info); kfree(info);
retStatus = ISD200_ERROR; retStatus = ISD200_ERROR;
} else }
memset(info->id, 0, sizeof(struct hd_driveid));
} }
if (retStatus == ISD200_GOOD) { if (retStatus == ISD200_GOOD) {
......
...@@ -441,12 +441,11 @@ int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us) ...@@ -441,12 +441,11 @@ int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us)
}; };
if (!us->extra) { if (!us->extra) {
us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_NOIO); us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
if (!us->extra) { if (!us->extra) {
US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n"); US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
memset(us->extra, 0, sizeof(struct jumpshot_info));
us->extra_destructor = jumpshot_info_destructor; us->extra_destructor = jumpshot_info_destructor;
} }
......
...@@ -751,11 +751,10 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -751,11 +751,10 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
struct sddr55_card_info *info; struct sddr55_card_info *info;
if (!us->extra) { if (!us->extra) {
us->extra = kmalloc( us->extra = kzalloc(
sizeof(struct sddr55_card_info), GFP_NOIO); sizeof(struct sddr55_card_info), GFP_NOIO);
if (!us->extra) if (!us->extra)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
memset(us->extra, 0, sizeof(struct sddr55_card_info));
us->extra_destructor = sddr55_card_info_destructor; us->extra_destructor = sddr55_card_info_destructor;
} }
......
...@@ -1318,12 +1318,11 @@ int init_usbat(struct us_data *us) ...@@ -1318,12 +1318,11 @@ int init_usbat(struct us_data *us)
unsigned char subcountL = USBAT_ATA_LBA_ME; unsigned char subcountL = USBAT_ATA_LBA_ME;
unsigned char *status = us->iobuf; unsigned char *status = us->iobuf;
us->extra = kmalloc(sizeof(struct usbat_info), GFP_NOIO); us->extra = kzalloc(sizeof(struct usbat_info), GFP_NOIO);
if (!us->extra) { if (!us->extra) {
US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n"); US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n");
return 1; return 1;
} }
memset(us->extra, 0, sizeof(struct usbat_info));
info = (struct usbat_info *) (us->extra); info = (struct usbat_info *) (us->extra);
/* Enable peripheral control signals */ /* Enable peripheral control signals */
......
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