aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2010-04-17 11:12:58 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:39 -0400
commite8f4af304e3d16e7e512865bd53f3db811d9bbc8 (patch)
tree60dd9c054a0a10470a19dfde58a09e72355188e3
parent65e0b499105ec8ff3bc4ab7680873dec20127f9d (diff)
USB: core: config.c: usb_get_configuration() simplified
usb_gat_configuratio() used two pointers to point to the same memory. Code simplified, by removing one of them. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/config.c10
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
825err: 823err:
826 kfree(buffer); 824 kfree(desc);
827out_not_authorized: 825out_not_authorized:
828 dev->descriptor.bNumConfigurations = cfgno; 826 dev->descriptor.bNumConfigurations = cfgno;
829err2: 827err2: