summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2010-04-17 17:12:58 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 13:21:39 -0700
commite8f4af304e3d16e7e512865bd53f3db811d9bbc8 (patch)
tree60dd9c054a0a10470a19dfde58a09e72355188e3 /drivers/usb/core
parent65e0b499105ec8ff3bc4ab7680873dec20127f9d (diff)
downloadop-kernel-dev-e8f4af304e3d16e7e512865bd53f3db811d9bbc8.zip
op-kernel-dev-e8f4af304e3d16e7e512865bd53f3db811d9bbc8.tar.gz
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>
Diffstat (limited to 'drivers/usb/core')
-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 16c1157..e4909c2 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)
int ncfg = dev->descriptor.bNumConfigurations;
int result = 0;
unsigned int cfgno, length;
- unsigned char *buffer;
unsigned char *bigbuffer;
struct usb_config_descriptor *desc;
@@ -764,17 +763,16 @@ int usb_get_configuration(struct usb_device *dev)
if (!dev->rawdescriptors)
goto err2;
- buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
- if (!buffer)
+ desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
+ if (!desc)
goto err2;
- desc = (struct usb_config_descriptor *)buffer;
result = 0;
for (; cfgno < ncfg; cfgno++) {
/* We grab just the first descriptor so we know how long
* the whole configuration is */
result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,
- buffer, USB_DT_CONFIG_SIZE);
+ desc, USB_DT_CONFIG_SIZE);
if (result < 0) {
dev_err(ddev, "unable to read config index %d "
"descriptor/%s: %d\n", cfgno, "start", result);
@@ -823,7 +821,7 @@ int usb_get_configuration(struct usb_device *dev)
result = 0;
err:
- kfree(buffer);
+ kfree(desc);
out_not_authorized:
dev->descriptor.bNumConfigurations = cfgno;
err2:
OpenPOWER on IntegriCloud