speedtch usbatm.c,1.46,1.47

Duncan Sands duncan at infradead.org
Fri May 27 12:17:26 EDT 2005


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv2614

Modified Files:
	usbatm.c 
Log Message:
Use kcalloc rather than kmalloc + memset.


Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- usbatm.c	27 May 2005 07:55:14 -0000	1.46
+++ usbatm.c	27 May 2005 16:17:23 -0000	1.47
@@ -949,7 +949,6 @@
 	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 @@
 			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;




More information about the Usbatm-commits mailing list