Skip to content

Commit

Permalink
usb: gadget: f_phonet: fix memory allocation sizes
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Jun 2, 2009
1 parent c69367f commit b61b8af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,10 @@ static struct net_device *dev;
int __init phonet_bind_config(struct usb_configuration *c)
{
struct f_phonet *fp;
int err;
int err, size;

fp = kzalloc(sizeof(*fp), GFP_KERNEL);
size = sizeof(*fp) + (phonet_rxq_size * sizeof(struct usb_request *));
fp = kzalloc(size, GFP_KERNEL);
if (!fp)
return -ENOMEM;

Expand All @@ -596,9 +597,7 @@ int __init gphonet_setup(struct usb_gadget *gadget)

/* Create net device */
BUG_ON(dev);
dev = alloc_netdev(sizeof(*port)
+ (phonet_rxq_size * sizeof(struct usb_request *)),
"upnlink%d", pn_net_setup);
dev = alloc_netdev(sizeof(*port), "upnlink%d", pn_net_setup);
if (!dev)
return -ENOMEM;

Expand Down

0 comments on commit b61b8af

Please sign in to comment.