diff options
-rw-r--r-- | drivers/usb/core/config.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 16c1157be3fc..e4909c26becb 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -735,7 +735,6 @@ int usb_get_configuration(struct usb_device *dev) | |||
735 | int ncfg = dev->descriptor.bNumConfigurations; | 735 | int ncfg = dev->descriptor.bNumConfigurations; |
736 | int result = 0; | 736 | int result = 0; |
737 | unsigned int cfgno, length; | 737 | unsigned int cfgno, length; |
738 | unsigned char *buffer; | ||
739 | unsigned char *bigbuffer; | 738 | unsigned char *bigbuffer; |
740 | struct usb_config_descriptor *desc; | 739 | struct usb_config_descriptor *desc; |
741 | 740 | ||
@@ -764,17 +763,16 @@ int usb_get_configuration(struct usb_device *dev) | |||
764 | if (!dev->rawdescriptors) | 763 | if (!dev->rawdescriptors) |
765 | goto err2; | 764 | goto err2; |
766 | 765 | ||
767 | buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL); | 766 | desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL); |
768 | if (!buffer) | 767 | if (!desc) |
769 | goto err2; | 768 | goto err2; |
770 | desc = (struct usb_config_descriptor *)buffer; | ||
771 | 769 | ||
772 | result = 0; | 770 | result = 0; |
773 | for (; cfgno < ncfg; cfgno++) { | 771 | for (; cfgno < ncfg; cfgno++) { |
774 | /* We grab just the first descriptor so we know how long | 772 | /* We grab just the first descriptor so we know how long |
775 | * the whole configuration is */ | 773 | * the whole configuration is */ |
776 | result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, | 774 | result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, |
777 | buffer, USB_DT_CONFIG_SIZE); | 775 | desc, USB_DT_CONFIG_SIZE); |
778 | if (result < 0) { | 776 | if (result < 0) { |
779 | dev_err(ddev, "unable to read config index %d " | 777 | dev_err(ddev, "unable to read config index %d " |
780 | "descriptor/%s: %d\n", cfgno, "start", result); | 778 | "descriptor/%s: %d\n", cfgno, "start", result); |
@@ -823,7 +821,7 @@ int usb_get_configuration(struct usb_device *dev) | |||
823 | result = 0; | 821 | result = 0; |
824 | 822 | ||
825 | err: | 823 | err: |
826 | kfree(buffer); | 824 | kfree(desc); |
827 | out_not_authorized: | 825 | out_not_authorized: |
828 | dev->descriptor.bNumConfigurations = cfgno; | 826 | dev->descriptor.bNumConfigurations = cfgno; |
829 | err2: | 827 | err2: |