If xtype is XTYPE_UNKNOWN, it will *always* be replaced by the real detected type in xpad_probe(). It is therefore not possible to encounter the xtype == XTYPE_UNKNOWN condition anywhere at the run-time of the driver. That means we can drop those checks. Signed-off-by: Benjamin Valentin <benpicco@xxxxxxxxxxxxxx> --- drivers/input/joystick/xpad.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 31a268f43b5b..66a12da58619 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1110,13 +1110,10 @@ static void xpad_irq_out(struct urb *urb) } static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad, - struct usb_endpoint_descriptor *ep_irq_out) + struct usb_endpoint_descriptor *ep_irq_out) { int error; - if (xpad->xtype == XTYPE_UNKNOWN) - return 0; - init_usb_anchor(&xpad->irq_out_anchor); xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, @@ -1148,23 +1145,19 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad, static void xpad_stop_output(struct usb_xpad *xpad) { - if (xpad->xtype != XTYPE_UNKNOWN) { - if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor, - 5000)) { - dev_warn(&xpad->intf->dev, - "timed out waiting for output URB to complete, killing\n"); - usb_kill_anchored_urbs(&xpad->irq_out_anchor); - } + if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor, + 5000)) { + dev_warn(&xpad->intf->dev, + "timed out waiting for output URB to complete, killing\n"); + usb_kill_anchored_urbs(&xpad->irq_out_anchor); } } static void xpad_deinit_output(struct usb_xpad *xpad) { - if (xpad->xtype != XTYPE_UNKNOWN) { - usb_free_urb(xpad->irq_out); - usb_free_coherent(xpad->udev, XPAD_PKT_LEN, - xpad->odata, xpad->odata_dma); - } + usb_free_urb(xpad->irq_out); + usb_free_coherent(xpad->udev, XPAD_PKT_LEN, + xpad->odata, xpad->odata_dma); } static int xpad_inquiry_pad_presence(struct usb_xpad *xpad) @@ -1339,9 +1332,6 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect static int xpad_init_ff(struct usb_xpad *xpad) { - if (xpad->xtype == XTYPE_UNKNOWN) - return 0; - input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); return input_ff_create_memless(xpad->dev, NULL, xpad_play_effect); -- 2.32.0