aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan Sands <duncan.sands@math.u-psud.fr>2005-05-28 16:06:20 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 17:43:58 -0400
commitf0706930091902641929f2229bfb106144782c94 (patch)
tree64618963505fcf4413b95b95bda8efb572ba2c9c
parent843c944fb86e5e31ee7b319172e657ea22301322 (diff)
[PATCH] USB: usbatm kcalloc cleanup
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>
-rw-r--r--drivers/usb/atm/usbatm.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index b178c800ced8..bb1db1959854 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -949,7 +949,6 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
949 struct usb_device *usb_dev = interface_to_usbdev(intf); 949 struct usb_device *usb_dev = interface_to_usbdev(intf);
950 struct usbatm_data *instance; 950 struct usbatm_data *instance;
951 char *buf; 951 char *buf;
952 size_t instance_size = sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs);
953 int error = -ENOMEM; 952 int error = -ENOMEM;
954 int i, length; 953 int i, length;
955 int need_heavy; 954 int need_heavy;
@@ -961,14 +960,12 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
961 intf->altsetting->desc.bInterfaceNumber); 960 intf->altsetting->desc.bInterfaceNumber);
962 961
963 /* instance init */ 962 /* instance init */
964 instance = kmalloc(instance_size, GFP_KERNEL); 963 instance = kcalloc(1, sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL);
965 if (!instance) { 964 if (!instance) {
966 dev_dbg(dev, "%s: no memory for instance data!\n", __func__); 965 dev_dbg(dev, "%s: no memory for instance data!\n", __func__);
967 return -ENOMEM; 966 return -ENOMEM;
968 } 967 }
969 968
970 memset(instance, 0, instance_size);
971
972 /* public fields */ 969 /* public fields */
973 970
974 instance->driver = driver; 971 instance->driver = driver;