mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6.19-rc5] USB gadget: replace kmalloc+memset with kzalloc
@ 2006-11-22 18:49 Burman Yan
  0 siblings, 0 replies; only message in thread
From: Burman Yan @ 2006-11-22 18:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, dbrownell

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

Hi.

This trivial patch replaces kmalloc+memset with kzalloc in the usb gadget 
sources.

Regards
Yan Buman

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

[-- Attachment #2: kzalloc_usb_gadget.patch --]
[-- Type: application/octet-stream, Size: 1637 bytes --]

Replace kmalloc+memset with kzalloc

Signed-off-by: Yan Burman <yan_952@hotmail.com>

diff -rubp linux-2.6.19-rc6_orig/drivers/usb/gadget/goku_udc.c linux-2.6.19-rc6/drivers/usb/gadget/goku_udc.c
--- linux-2.6.19-rc6_orig/drivers/usb/gadget/goku_udc.c	2006-11-22 20:29:31.000000000 +0200
+++ linux-2.6.19-rc6/drivers/usb/gadget/goku_udc.c	2006-11-22 20:33:23.000000000 +0200
@@ -1864,14 +1864,13 @@ static int goku_probe(struct pci_dev *pd
 	}
 
 	/* alloc, and start init */
-	dev = kmalloc (sizeof *dev, SLAB_KERNEL);
+	dev = kzalloc (sizeof *dev, SLAB_KERNEL);
 	if (dev == NULL){
 		pr_debug("enomem %s\n", pci_name(pdev));
 		retval = -ENOMEM;
 		goto done;
 	}
 
-	memset(dev, 0, sizeof *dev);
 	spin_lock_init(&dev->lock);
 	dev->pdev = pdev;
 	dev->gadget.ops = &goku_ops;
diff -rubp linux-2.6.19-rc6_orig/drivers/usb/gadget/serial.c linux-2.6.19-rc6/drivers/usb/gadget/serial.c
--- linux-2.6.19-rc6_orig/drivers/usb/gadget/serial.c	2006-11-22 20:29:31.000000000 +0200
+++ linux-2.6.19-rc6/drivers/usb/gadget/serial.c	2006-11-22 20:33:23.000000000 +0200
@@ -1429,7 +1429,7 @@ static int __init gs_bind(struct usb_gad
 		gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
 	}
 
-	gs_device = dev = kmalloc(sizeof(struct gs_dev), GFP_KERNEL);
+	gs_device = dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL);
 	if (dev == NULL)
 		return -ENOMEM;
 
@@ -1437,7 +1437,6 @@ static int __init gs_bind(struct usb_gad
 		init_utsname()->sysname, init_utsname()->release,
 		gadget->name);
 
-	memset(dev, 0, sizeof(struct gs_dev));
 	dev->dev_gadget = gadget;
 	spin_lock_init(&dev->dev_lock);
 	INIT_LIST_HEAD(&dev->dev_req_list);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-11-22 18:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-22 18:49 [PATCH 2.6.19-rc5] USB gadget: replace kmalloc+memset with kzalloc Burman Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®