diff options
Diffstat (limited to 'drivers/usb/core/config.c')
-rw-r--r-- | drivers/usb/core/config.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 1a8edcee7f30..a92122a216bc 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -238,7 +238,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | |||
238 | 238 | ||
239 | /* Allocate space for the right(?) number of endpoints */ | 239 | /* Allocate space for the right(?) number of endpoints */ |
240 | num_ep = num_ep_orig = alt->desc.bNumEndpoints; | 240 | num_ep = num_ep_orig = alt->desc.bNumEndpoints; |
241 | alt->desc.bNumEndpoints = 0; // Use as a counter | 241 | alt->desc.bNumEndpoints = 0; /* Use as a counter */ |
242 | if (num_ep > USB_MAXENDPOINTS) { | 242 | if (num_ep > USB_MAXENDPOINTS) { |
243 | dev_warn(ddev, "too many endpoints for config %d interface %d " | 243 | dev_warn(ddev, "too many endpoints for config %d interface %d " |
244 | "altsetting %d: %d, using maximum allowed: %d\n", | 244 | "altsetting %d: %d, using maximum allowed: %d\n", |
@@ -246,7 +246,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | |||
246 | num_ep = USB_MAXENDPOINTS; | 246 | num_ep = USB_MAXENDPOINTS; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (num_ep > 0) { /* Can't allocate 0 bytes */ | 249 | if (num_ep > 0) { |
250 | /* Can't allocate 0 bytes */ | ||
250 | len = sizeof(struct usb_host_endpoint) * num_ep; | 251 | len = sizeof(struct usb_host_endpoint) * num_ep; |
251 | alt->endpoint = kzalloc(len, GFP_KERNEL); | 252 | alt->endpoint = kzalloc(len, GFP_KERNEL); |
252 | if (!alt->endpoint) | 253 | if (!alt->endpoint) |
@@ -475,8 +476,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx, | |||
475 | return 0; | 476 | return 0; |
476 | } | 477 | } |
477 | 478 | ||
478 | // hub-only!! ... and only exported for reset/reinit path. | 479 | /* hub-only!! ... and only exported for reset/reinit path. |
479 | // otherwise used internally on disconnect/destroy path | 480 | * otherwise used internally on disconnect/destroy path |
481 | */ | ||
480 | void usb_destroy_configuration(struct usb_device *dev) | 482 | void usb_destroy_configuration(struct usb_device *dev) |
481 | { | 483 | { |
482 | int c, i; | 484 | int c, i; |
@@ -498,7 +500,7 @@ void usb_destroy_configuration(struct usb_device *dev) | |||
498 | kfree(cf->string); | 500 | kfree(cf->string); |
499 | for (i = 0; i < cf->desc.bNumInterfaces; i++) { | 501 | for (i = 0; i < cf->desc.bNumInterfaces; i++) { |
500 | if (cf->intf_cache[i]) | 502 | if (cf->intf_cache[i]) |
501 | kref_put(&cf->intf_cache[i]->ref, | 503 | kref_put(&cf->intf_cache[i]->ref, |
502 | usb_release_interface_cache); | 504 | usb_release_interface_cache); |
503 | } | 505 | } |
504 | } | 506 | } |
@@ -525,7 +527,7 @@ int usb_get_configuration(struct usb_device *dev) | |||
525 | unsigned int cfgno, length; | 527 | unsigned int cfgno, length; |
526 | unsigned char *buffer; | 528 | unsigned char *buffer; |
527 | unsigned char *bigbuffer; | 529 | unsigned char *bigbuffer; |
528 | struct usb_config_descriptor *desc; | 530 | struct usb_config_descriptor *desc; |
529 | 531 | ||
530 | cfgno = 0; | 532 | cfgno = 0; |
531 | if (dev->authorized == 0) /* Not really an error */ | 533 | if (dev->authorized == 0) /* Not really an error */ |