USB: onetouch - handle errors from input_register_device()
Onetouch: handle errors from input_register_device() Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bd35078f47
commit
17efe15525
@@ -135,6 +135,7 @@ int onetouch_connect_input(struct us_data *ss)
|
|||||||
struct usb_onetouch *onetouch;
|
struct usb_onetouch *onetouch;
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
int pipe, maxp;
|
int pipe, maxp;
|
||||||
|
int error = -ENOMEM;
|
||||||
|
|
||||||
interface = ss->pusb_intf->cur_altsetting;
|
interface = ss->pusb_intf->cur_altsetting;
|
||||||
|
|
||||||
@@ -211,15 +212,18 @@ int onetouch_connect_input(struct us_data *ss)
|
|||||||
ss->suspend_resume_hook = usb_onetouch_pm_hook;
|
ss->suspend_resume_hook = usb_onetouch_pm_hook;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
input_register_device(onetouch->dev);
|
error = input_register_device(onetouch->dev);
|
||||||
|
if (error)
|
||||||
|
goto fail3;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
fail3: usb_free_urb(onetouch->irq);
|
||||||
fail2: usb_buffer_free(udev, ONETOUCH_PKT_LEN,
|
fail2: usb_buffer_free(udev, ONETOUCH_PKT_LEN,
|
||||||
onetouch->data, onetouch->data_dma);
|
onetouch->data, onetouch->data_dma);
|
||||||
fail1: kfree(onetouch);
|
fail1: kfree(onetouch);
|
||||||
input_free_device(input_dev);
|
input_free_device(input_dev);
|
||||||
return -ENOMEM;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onetouch_release_input(void *onetouch_)
|
void onetouch_release_input(void *onetouch_)
|
||||||
|
Reference in New Issue
Block a user