summaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/xpad.c
diff options
context:
space:
mode:
authorPavel Rojtberg <rojtberg@gmail.com>2016-05-27 16:26:33 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-06 10:31:51 -0800
commita8c34e27fb1ece928ec728bfe596aa6ca0b1928a (patch)
tree5b868886fb58ddc31c153dd210b6c9246847526c /drivers/input/joystick/xpad.c
parent4f88476c75429ba9ab71c428b4cd2f67575bc9c1 (diff)
downloadop-kernel-dev-a8c34e27fb1ece928ec728bfe596aa6ca0b1928a.zip
op-kernel-dev-a8c34e27fb1ece928ec728bfe596aa6ca0b1928a.tar.gz
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: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/joystick/xpad.c')
-rw-r--r--drivers/input/joystick/xpad.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 9ddd851..3f6130e 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -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,
GFP_KERNEL, &xpad->odata_dma);
- if (!xpad->odata) {
- error = -ENOMEM;
- goto fail1;
- }
+ if (!xpad->odata)
+ return -ENOMEM;
spin_lock_init(&xpad->odata_lock);
xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL);
if (!xpad->irq_out) {
error = -ENOMEM;
- goto fail2;
+ goto err_free_coherent;
}
/* 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)
return 0;
- fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
- fail1: return error;
+err_free_coherent:
+ usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma);
+ return error;
}
static void xpad_stop_output(struct usb_xpad *xpad)
OpenPOWER on IntegriCloud