diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2010-02-04 03:20:35 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-02-04 03:22:01 -0500 |
commit | 1e87a43080a259a0e9739377708ece163b08de8d (patch) | |
tree | 1742cdf25086b879d97cdbd07d66168b9cb61283 /drivers/input/touchscreen | |
parent | 5197424cdcccd2b0b1922babb93969b2515c43ce (diff) |
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')
-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, | |||
1412 | err = type->init(usbtouch); | 1412 | err = type->init(usbtouch); |
1413 | if (err) { | 1413 | if (err) { |
1414 | dbg("%s - type->init() failed, err: %d", __func__, err); | 1414 | dbg("%s - type->init() failed, err: %d", __func__, err); |
1415 | goto out_free_buffers; | 1415 | goto out_free_urb; |
1416 | } | 1416 | } |
1417 | } | 1417 | } |
1418 | 1418 | ||
@@ -1424,14 +1424,25 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1424 | 1424 | ||
1425 | usb_set_intfdata(intf, usbtouch); | 1425 | usb_set_intfdata(intf, usbtouch); |
1426 | 1426 | ||
1427 | if (usbtouch->type->irq_always) | 1427 | if (usbtouch->type->irq_always) { |
1428 | usb_submit_urb(usbtouch->irq, GFP_KERNEL); | 1428 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); |
1429 | if (err) { | ||
1430 | err("%s - usb_submit_urb failed with result: %d", | ||
1431 | __func__, err); | ||
1432 | goto out_unregister_input; | ||
1433 | } | ||
1434 | } | ||
1429 | 1435 | ||
1430 | return 0; | 1436 | return 0; |
1431 | 1437 | ||
1438 | out_unregister_input: | ||
1439 | input_unregister_device(input_dev); | ||
1440 | input_dev = NULL; | ||
1432 | out_do_exit: | 1441 | out_do_exit: |
1433 | if (type->exit) | 1442 | if (type->exit) |
1434 | type->exit(usbtouch); | 1443 | type->exit(usbtouch); |
1444 | out_free_urb: | ||
1445 | usb_free_urb(usbtouch->irq); | ||
1435 | out_free_buffers: | 1446 | out_free_buffers: |
1436 | usbtouch_free_buffers(udev, usbtouch); | 1447 | usbtouch_free_buffers(udev, usbtouch); |
1437 | out_free: | 1448 | out_free: |