Commit 1e87a430 authored by Ondrej Zary's avatar Ondrej Zary Committed by Dmitry Torokhov

Input: usbtouchscreen - fix leaks and check return value of usb_submit_urb()

Fix urb leak in error path of initialization and make sure we handle
errors from initial usb_submit_urb().
Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 5197424c
...@@ -1412,7 +1412,7 @@ static int usbtouch_probe(struct usb_interface *intf, ...@@ -1412,7 +1412,7 @@ static int usbtouch_probe(struct usb_interface *intf,
err = type->init(usbtouch); err = type->init(usbtouch);
if (err) { if (err) {
dbg("%s - type->init() failed, err: %d", __func__, err); dbg("%s - type->init() failed, err: %d", __func__, err);
goto out_free_buffers; goto out_free_urb;
} }
} }
...@@ -1424,14 +1424,25 @@ static int usbtouch_probe(struct usb_interface *intf, ...@@ -1424,14 +1424,25 @@ static int usbtouch_probe(struct usb_interface *intf,
usb_set_intfdata(intf, usbtouch); usb_set_intfdata(intf, usbtouch);
if (usbtouch->type->irq_always) if (usbtouch->type->irq_always) {
usb_submit_urb(usbtouch->irq, GFP_KERNEL); err = usb_submit_urb(usbtouch->irq, GFP_KERNEL);
if (err) {
err("%s - usb_submit_urb failed with result: %d",
__func__, err);
goto out_unregister_input;
}
}
return 0; return 0;
out_unregister_input:
input_unregister_device(input_dev);
input_dev = NULL;
out_do_exit: out_do_exit:
if (type->exit) if (type->exit)
type->exit(usbtouch); type->exit(usbtouch);
out_free_urb:
usb_free_urb(usbtouch->irq);
out_free_buffers: out_free_buffers:
usbtouch_free_buffers(udev, usbtouch); usbtouch_free_buffers(udev, usbtouch);
out_free: out_free:
......
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