diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2010-02-04 00:20:35 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-02-04 00:22:01 -0800 |
commit | 1e87a43080a259a0e9739377708ece163b08de8d (patch) | |
tree | 1742cdf25086b879d97cdbd07d66168b9cb61283 /drivers/input/touchscreen/usbtouchscreen.c | |
parent | 5197424cdcccd2b0b1922babb93969b2515c43ce (diff) | |
download | blackbird-obmc-linux-1e87a43080a259a0e9739377708ece163b08de8d.tar.gz blackbird-obmc-linux-1e87a43080a259a0e9739377708ece163b08de8d.zip |
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: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 07656efee654..7a2d39abc586 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1412,7 +1412,7 @@ static int usbtouch_probe(struct usb_interface *intf, err = type->init(usbtouch); if (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, usb_set_intfdata(intf, usbtouch); - if (usbtouch->type->irq_always) - usb_submit_urb(usbtouch->irq, GFP_KERNEL); + if (usbtouch->type->irq_always) { + 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; +out_unregister_input: + input_unregister_device(input_dev); + input_dev = NULL; out_do_exit: if (type->exit) type->exit(usbtouch); +out_free_urb: + usb_free_urb(usbtouch->irq); out_free_buffers: usbtouch_free_buffers(udev, usbtouch); out_free: |