diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/config.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index bfb3731d42db..2d4fd530e5e4 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -185,10 +185,12 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | |||
185 | num_ep = USB_MAXENDPOINTS; | 185 | num_ep = USB_MAXENDPOINTS; |
186 | } | 186 | } |
187 | 187 | ||
188 | len = sizeof(struct usb_host_endpoint) * num_ep; | 188 | if (num_ep > 0) { /* Can't allocate 0 bytes */ |
189 | alt->endpoint = kzalloc(len, GFP_KERNEL); | 189 | len = sizeof(struct usb_host_endpoint) * num_ep; |
190 | if (!alt->endpoint) | 190 | alt->endpoint = kzalloc(len, GFP_KERNEL); |
191 | return -ENOMEM; | 191 | if (!alt->endpoint) |
192 | return -ENOMEM; | ||
193 | } | ||
192 | 194 | ||
193 | /* Parse all the endpoint descriptors */ | 195 | /* Parse all the endpoint descriptors */ |
194 | n = 0; | 196 | n = 0; |