Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185306
b: refs/heads/master
c: d0ef90b
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 562071f commit 8de89a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 96679f6bd5e1ccb30671b81636b4fdc326e46d8a
refs/heads/master: d0ef90b49857b403c1cfa62fce229c967dd4be40
35 changes: 18 additions & 17 deletions trunk/drivers/usb/serial/io_edgeport.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,31 +372,32 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial)
************************************************************************/
static int get_string(struct usb_device *dev, int Id, char *string, int buflen)
{
struct usb_string_descriptor StringDesc;
struct usb_string_descriptor *pStringDesc;
struct usb_string_descriptor *StringDesc = NULL;
struct usb_string_descriptor *pStringDesc = NULL;
int ret = 0;

dbg("%s - USB String ID = %d", __func__, Id);

if (!usb_get_descriptor(dev, USB_DT_STRING, Id,
&StringDesc, sizeof(StringDesc)))
return 0;
StringDesc = kmalloc(sizeof(*StringDesc), GFP_KERNEL);
if (!StringDesc)
goto free;
if (usb_get_descriptor(dev, USB_DT_STRING, Id, StringDesc, sizeof(*StringDesc)) <= 0)
goto free;

pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL);
pStringDesc = kmalloc(StringDesc->bLength, GFP_KERNEL);
if (!pStringDesc)
return 0;
goto free;

if (!usb_get_descriptor(dev, USB_DT_STRING, Id,
pStringDesc, StringDesc.bLength)) {
kfree(pStringDesc);
return 0;
}

unicode_to_ascii(string, buflen,
pStringDesc->wData, pStringDesc->bLength/2);
if (usb_get_descriptor(dev, USB_DT_STRING, Id, pStringDesc, StringDesc->bLength) <= 0)
goto free;

kfree(pStringDesc);
unicode_to_ascii(string, buflen, pStringDesc->wData, pStringDesc->bLength/2);
ret = strlen(string);
dbg("%s - USB String %s", __func__, string);
return strlen(string);
free:
kfree(StringDesc);
kfree(pStringDesc);
return ret;
}


Expand Down

0 comments on commit 8de89a3

Please sign in to comment.