Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354435
b: refs/heads/master
c: db7dabf
h: refs/heads/master
i:
  354433: c0ab119
  354431: ff25604
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Feb 6, 2013
1 parent 43dd0d2 commit e819ffc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 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: 1cc8f8854c86b77637b1300b22e553028c6f2668
refs/heads/master: db7dabf707f1eb3c4288ca8bedd4b2aa6701ca7b
39 changes: 25 additions & 14 deletions trunk/drivers/staging/comedi/drivers/vmk80xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,8 +1323,6 @@ static void vmk80xx_detach(struct comedi_device *dev)

dev->private = NULL;

devpriv->attached = 0;
devpriv->probed = 0;
usb_set_intfdata(devpriv->intf, NULL);

usb_kill_anchored_urbs(&devpriv->rx_anchor);
Expand All @@ -1334,6 +1332,14 @@ static void vmk80xx_detach(struct comedi_device *dev)
kfree(devpriv->usb_tx_buf);

up(&devpriv->limit_sem);

/*
* Since 'devpriv' points to an element of the static vmb array
* we can't kfree it. Instead memset it to all '0' so subsequent
* usb probes don't find any garbage in it.
*/
memset(devpriv, 0x00, sizeof(*devpriv));

mutex_unlock(&glb_mutex);
}

Expand All @@ -1359,25 +1365,19 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
break;

if (i == VMK80XX_MAX_BOARDS) {
mutex_unlock(&glb_mutex);
return -EMFILE;
ret = -EMFILE;
goto fail;
}

devpriv = &vmb[i];

memset(devpriv, 0x00, sizeof(*devpriv));

ret = vmk80xx_find_usb_endpoints(devpriv, intf);
if (ret) {
mutex_unlock(&glb_mutex);
return ret;
}
if (ret)
goto error;

ret = vmk80xx_alloc_usb_buffers(devpriv);
if (ret) {
mutex_unlock(&glb_mutex);
return ret;
}
if (ret)
goto error;

devpriv->usb = interface_to_usbdev(intf);
devpriv->intf = intf;
Expand Down Expand Up @@ -1416,6 +1416,17 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
comedi_usb_auto_config(intf, &vmk80xx_driver);

return 0;

error:
/*
* Since 'devpriv' points to an element of the static vmb array
* we can't kfree it. Instead memset it to all '0' so subsequent
* usb probes don't find any garbage in it.
*/
memset(devpriv, 0x00, sizeof(*devpriv));
fail:
mutex_unlock(&glb_mutex);
return ret;
}

static const struct usb_device_id vmk80xx_usb_id_table[] = {
Expand Down

0 comments on commit e819ffc

Please sign in to comment.