[PATCH] USB: usbatm kcalloc cleanup
authorDuncan Sands <duncan.sands@math.u-psud.fr>
Sat, 28 May 2005 20:06:20 +0000 (22:06 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Jun 2005 21:43:58 +0000 (14:43 -0700)
you seem to have applied the original, not the new improved one with
whiter teeth that uses kcalloc instead of kmalloc + memset.  Here's a
patch that goes on top of the one you applied.

Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/atm/usbatm.c

index b178c800ced8045f87f6528a13514b21232a072b..bb1db19598549ee10322f9d7ff0562f4f11cad2c 100644 (file)
@@ -949,7 +949,6 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
        struct usb_device *usb_dev = interface_to_usbdev(intf);
        struct usbatm_data *instance;
        char *buf;
-       size_t instance_size = sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs);
        int error = -ENOMEM;
        int i, length;
        int need_heavy;
@@ -961,14 +960,12 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
                        intf->altsetting->desc.bInterfaceNumber);
 
        /* instance init */
-       instance = kmalloc(instance_size, GFP_KERNEL);
+       instance = kcalloc(1, sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL);
        if (!instance) {
                dev_dbg(dev, "%s: no memory for instance data!\n", __func__);
                return -ENOMEM;
        }
 
-       memset(instance, 0, instance_size);
-
        /* public fields */
 
        instance->driver = driver;