IR/imon: remove incorrect calls to input_free_device
PATCH 1/1 IR/imon: remove incorrect calls to input_free_device
Per Dmitry Torokhov (in a completely unrelated thread on linux-input), following input_unregister_device with an input_free_device is forbidden, the former is sufficient alone.
--- drivers/media/IR/imon.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/media/IR/imon.c +1 -4
@@ -1944,7 +1944,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) urb_submit_failed:ir_input_unregister (ictx->idev); -input_free_device (ictx->idev); idev_setup_failed: find_endpoint_failed:mutex_unlock (&ictx->lock);
@@ -2014,10 +2013,8 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,return ictx; urb_submit_failed: -if (ictx->touch) { +if (ictx->touch)input_unregister_device (ictx->touch); -input_free_device (ictx->touch); - } touch_setup_failed: find_endpoint_failed:mutex_unlock (&ictx->lock);
Signature · 6 lines
1.7.1.1 -- Jarod Wilson [email protected]
Quoted 6 lines · Jarod Wilson
Per Dmitry Torokhov (in a completely unrelated thread on linux-input), following
input_unregister_devicewith aninput_free_deviceis forbidden, the former is sufficient alone.CC Dmitry Torokhov <[email protected]>Signed-off-by Jarod Wilson <[email protected]>
Random notes about irmon:
imon_init_idev():
memcpy(&ir->dev, ictx->dev, sizeof(struct device));
This is... scary. Devices are refcounted and if you copy them around all hell may break loose. On an unrelated note you do not need memcpy to copy a structire, *it->dev = *ictx->dev will do.
imon_init_idev(), imon_init_touch(): - consizer returning proper error codes via ERR_PTR() and check wit IS_ERR().
Quoted 18 lines
--- drivers/media/IR/imon.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)drivers/media/IR/imon.c +0
-1@@ -1944,7 +1944,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) urb_submit_failed:ir_input_unregister (ictx->idev); -input_free_device (ictx->idev); idev_setup_failed: find_endpoint_failed:mutex_unlock (&ictx->lock);@@ -2014,10 +2013,8 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,return ictx;
drivers/media/IR/imon.c static struct imon_context *imon_init_intf1(struct usb_interface *intf, · line 2020
Quoted 10 lines
drivers/media/IR/imon.c +1
-3urb_submit_failed: -if (ictx->touch) { +if (ictx->touch)input_unregister_device (ictx->touch); -input_free_device (ictx->touch); - } touch_setup_failed: find_endpoint_failed:mutex_unlock (&ictx->lock);
Thanks.
Signature · 1 line
Dmitry
Quoted 15 lines · Dmitry Torokhov
Quoted 6 lines · Jarod Wilson
Per Dmitry Torokhov (in a completely unrelated thread on linux-input), following
input_unregister_devicewith aninput_free_deviceis forbidden, the former is sufficient alone.CC Dmitry Torokhov <[email protected]>Signed-off-by Jarod Wilson <[email protected]>Acked-by Dmitry Torokhov <[email protected]>Random notes about irmon:
imon_init_idev():
memcpy(&ir->dev,ictx->dev, sizeof(struct device));
Quoted 6 lines
This is... scary. Devices are refcounted and if you copy them around all hell may break loose. On an unrelated note you do not need memcpy to copy a structire,
*it->dev=*ictx->devwill do.
imon_init_idev(),imon_init_touch(): - consizer returning proper error codes viaERR_PTR()and check witIS_ERR().
Hm, I'm overdue to give that driver another look (bz.k.o #16351), will add looking at these to the TODO list... (have immortalized them in the bz).
Signature · 2 lines
Jarod Wilson [email protected]