Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354433
b: refs/heads/master
c: 78f8fa7
h: refs/heads/master
i:
  354431: ff25604
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Feb 6, 2013
1 parent 7c007dd commit c0ab119
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 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: 49253d542cc0f5f771dc254d248162a2a666649d
refs/heads/master: 78f8fa7f00689f4385c28b1b2be30c83f331c497
35 changes: 22 additions & 13 deletions trunk/drivers/staging/comedi/drivers/vmk80xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,25 @@ static int vmk80xx_find_usb_endpoints(struct vmk80xx_private *devpriv,
return 0;
}

static int vmk80xx_alloc_usb_buffers(struct vmk80xx_private *devpriv)
{
size_t size;

size = le16_to_cpu(devpriv->ep_rx->wMaxPacketSize);
devpriv->usb_rx_buf = kmalloc(size, GFP_KERNEL);
if (!devpriv->usb_rx_buf)
return -ENOMEM;

size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
devpriv->usb_tx_buf = kmalloc(size, GFP_KERNEL);
if (!devpriv->usb_tx_buf) {
kfree(devpriv->usb_rx_buf);
return -ENOMEM;
}

return 0;
}

static int vmk80xx_attach_common(struct comedi_device *dev,
struct vmk80xx_private *devpriv)
{
Expand Down Expand Up @@ -1333,7 +1352,6 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
{
const struct vmk80xx_board *boardinfo;
struct vmk80xx_private *devpriv;
size_t size;
int ret;
int i;

Expand All @@ -1359,19 +1377,10 @@ static int vmk80xx_usb_probe(struct usb_interface *intf,
return ret;
}

size = le16_to_cpu(devpriv->ep_rx->wMaxPacketSize);
devpriv->usb_rx_buf = kmalloc(size, GFP_KERNEL);
if (!devpriv->usb_rx_buf) {
mutex_unlock(&glb_mutex);
return -ENOMEM;
}

size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
devpriv->usb_tx_buf = kmalloc(size, GFP_KERNEL);
if (!devpriv->usb_tx_buf) {
kfree(devpriv->usb_rx_buf);
ret = vmk80xx_alloc_usb_buffers(devpriv);
if (ret) {
mutex_unlock(&glb_mutex);
return -ENOMEM;
return ret;
}

devpriv->usb = interface_to_usbdev(intf);
Expand Down

0 comments on commit c0ab119

Please sign in to comment.