Commit a8c34e27 authored by Pavel Rojtberg's avatar Pavel Rojtberg Committed by Dmitry Torokhov

Input: xpad - simplify error condition in init_output

Replace first goto with simple returns as we really are just returning
one error code.
Signed-off-by: default avatarPavel Rojtberg <rojtberg@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 4f88476c
...@@ -849,17 +849,15 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) ...@@ -849,17 +849,15 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN,
GFP_KERNEL, &xpad->odata_dma); GFP_KERNEL, &xpad->odata_dma);
if (!xpad->odata) { if (!xpad->odata)
error = -ENOMEM; return -ENOMEM;
goto fail1;
}
spin_lock_init(&xpad->odata_lock); spin_lock_init(&xpad->odata_lock);
xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL);
if (!xpad->irq_out) { if (!xpad->irq_out) {
error = -ENOMEM; error = -ENOMEM;
goto fail2; goto err_free_coherent;
} }
/* Xbox One controller has in/out endpoints swapped. */ /* Xbox One controller has in/out endpoints swapped. */
...@@ -875,8 +873,9 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) ...@@ -875,8 +873,9 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
return 0; return 0;
fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); err_free_coherent:
fail1: return error; usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
return error;
} }
static void xpad_stop_output(struct usb_xpad *xpad) static void xpad_stop_output(struct usb_xpad *xpad)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment