[PATCH] USB: kzalloc() conversion in drivers/usb/gadget
this patch converts drivers/usb to kzalloc usage. Compile tested with allyes config. I think there was a bug in drivers/usb/gadget/inode.c because it used sizeof(*data) for the kmalloc() and sizeof(data) for the memset(), since sizeof(data) just returns the size for a pointer. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
80b6ca4832
commit
7039f4224d
@@ -2178,10 +2178,9 @@ static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags)
|
||||
return -EIO;
|
||||
|
||||
for (i=0; i<GS_NUM_PORTS; i++) {
|
||||
if ((port=(struct gs_port *)kmalloc(sizeof(struct gs_port), kmalloc_flags)) == NULL)
|
||||
if ((port=kzalloc(sizeof(struct gs_port), kmalloc_flags)) == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(port, 0, sizeof(struct gs_port));
|
||||
port->port_dev = dev;
|
||||
port->port_num = i;
|
||||
port->port_line_coding.dwDTERate = cpu_to_le32(GS_DEFAULT_DTE_RATE);
|
||||
|
Reference in New Issue
Block a user