summaryrefslogtreecommitdiff
path: root/drivers/usb/input/xpad.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input/xpad.c')
-rw-r--r--drivers/usb/input/xpad.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index e4bc76ebc835..ca03d1fc233f 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -312,6 +312,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
struct input_dev *input_dev;
struct usb_endpoint_descriptor *ep_irq_in;
int i;
+ int error = -ENOMEM;
for (i = 0; xpad_device[i].idVendor; i++) {
if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
@@ -373,15 +374,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
xpad->irq_in->transfer_dma = xpad->idata_dma;
xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
- input_register_device(xpad->dev);
+ error = input_register_device(xpad->dev);
+ if (error)
+ goto fail3;
usb_set_intfdata(intf, xpad);
return 0;
-fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
-fail1: input_free_device(input_dev);
+ fail3: usb_free_urb(xpad->irq_in);
+ fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
+ fail1: input_free_device(input_dev);
kfree(xpad);
- return -ENOMEM;
+ return error;
}