diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2009-05-31 21:18:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-02 03:17:46 -0400 |
commit | b61b8af0f3883b451bb9c3b3eaea4379aca9f36f (patch) | |
tree | 5154e774e20e8879fb8152ad4b46d8ba51f59ccb /drivers/usb/gadget/f_phonet.c | |
parent | c69367fd6730a330c4ba54e9e699733439cbbabd (diff) |
usb: gadget: f_phonet: fix memory allocation sizes
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>
Diffstat (limited to 'drivers/usb/gadget/f_phonet.c')
-rw-r--r-- | drivers/usb/gadget/f_phonet.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index d6b48714d899..96fb118355b0 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -569,9 +569,10 @@ static struct net_device *dev; | |||
569 | int __init phonet_bind_config(struct usb_configuration *c) | 569 | int __init phonet_bind_config(struct usb_configuration *c) |
570 | { | 570 | { |
571 | struct f_phonet *fp; | 571 | struct f_phonet *fp; |
572 | int err; | 572 | int err, size; |
573 | 573 | ||
574 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); | 574 | size = sizeof(*fp) + (phonet_rxq_size * sizeof(struct usb_request *)); |
575 | fp = kzalloc(size, GFP_KERNEL); | ||
575 | if (!fp) | 576 | if (!fp) |
576 | return -ENOMEM; | 577 | return -ENOMEM; |
577 | 578 | ||
@@ -596,9 +597,7 @@ int __init gphonet_setup(struct usb_gadget *gadget) | |||
596 | 597 | ||
597 | /* Create net device */ | 598 | /* Create net device */ |
598 | BUG_ON(dev); | 599 | BUG_ON(dev); |
599 | dev = alloc_netdev(sizeof(*port) | 600 | dev = alloc_netdev(sizeof(*port), "upnlink%d", pn_net_setup); |
600 | + (phonet_rxq_size * sizeof(struct usb_request *)), | ||
601 | "upnlink%d", pn_net_setup); | ||
602 | if (!dev) | 601 | if (!dev) |
603 | return -ENOMEM; | 602 | return -ENOMEM; |
604 | 603 | ||