]> err.no Git - linux-2.6/commitdiff
[PATCH] USB: kzalloc for storage
authorOliver Neukum <oliver@neukum.org>
Sun, 8 Jan 2006 11:33:45 +0000 (12:33 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Mar 2006 22:49:52 +0000 (14:49 -0800)
another one for kzalloc. This covers the storage subdirectory.

Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/datafab.c
drivers/usb/storage/isd200.c
drivers/usb/storage/jumpshot.c
drivers/usb/storage/sddr55.c
drivers/usb/storage/shuttle_usbat.c

index 54e3e6c7ecd86362781e1ecc7f1e9c9b6f3ff348..01d8971ad7db3cfe5830aff3adade86f10e7586a 100644 (file)
@@ -512,13 +512,12 @@ int datafab_transport(struct scsi_cmnd * srb, struct us_data *us)
        };
 
        if (!us->extra) {
-               us->extra = kmalloc(sizeof(struct datafab_info), GFP_NOIO);
+               us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO);
                if (!us->extra) {
                        US_DEBUGP("datafab_transport:  Gah! "
                                  "Can't allocate storage for Datafab info struct!\n");
                        return USB_STOR_TRANSPORT_ERROR;
                }
-               memset(us->extra, 0, sizeof(struct datafab_info));
                us->extra_destructor = datafab_info_destructor;
                ((struct datafab_info *)us->extra)->lun = -1;
        }
index ecb328aa9ea1bb2f3feda239bba137ef3df2b63e..7308e8cbe8f972320c7dfcc76b6fabd1dca520c3 100644 (file)
@@ -1361,21 +1361,19 @@ static int isd200_init_info(struct us_data *us)
        struct isd200_info *info;
 
        info = (struct isd200_info *)
-                       kmalloc(sizeof(struct isd200_info), GFP_KERNEL);
+                       kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
        if (!info)
                retStatus = ISD200_ERROR;
        else {
-               memset(info, 0, sizeof(struct isd200_info));
                info->id = (struct hd_driveid *)
-                               kmalloc(sizeof(struct hd_driveid), GFP_KERNEL);
+                               kzalloc(sizeof(struct hd_driveid), GFP_KERNEL);
                info->RegsBuf = (unsigned char *)
                                kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
                if (!info->id || !info->RegsBuf) {
                        isd200_free_info_ptrs(info);
                        kfree(info);
                        retStatus = ISD200_ERROR;
-               } else
-                       memset(info->id, 0, sizeof(struct hd_driveid));
+               }
        }
 
        if (retStatus == ISD200_GOOD) {
index aff9d51c327cd2ee0d770417e62a70be80acfb84..5031aa98f6a977d13760cc9cde790e0e79751018 100644 (file)
@@ -441,12 +441,11 @@ int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us)
        };
 
        if (!us->extra) {
-               us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_NOIO);
+               us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
                if (!us->extra) {
                        US_DEBUGP("jumpshot_transport:  Gah! Can't allocate storage for jumpshot info struct!\n");
                        return USB_STOR_TRANSPORT_ERROR;
                }
-               memset(us->extra, 0, sizeof(struct jumpshot_info));
                us->extra_destructor = jumpshot_info_destructor;
        }
 
index 8451779f4269836f41a56cb06a38dfa479b2e7c1..0b1b5b59ca7b6d2423a002a143ef3cf2f1f207a5 100644 (file)
@@ -751,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;
        }
 
index fea176d7e79a3bcb5540df2cc7012944c3f191cc..f2bc5c9e23d59c7f1a7111b88ffe02df92776e34 100644 (file)
@@ -1318,12 +1318,11 @@ int init_usbat(struct us_data *us)
        unsigned char subcountL = USBAT_ATA_LBA_ME;
        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) {
                US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n");
                return 1;
        }
-       memset(us->extra, 0, sizeof(struct usbat_info));
        info = (struct usbat_info *) (us->extra);
 
        /* Enable peripheral control signals */