diff options
author | Oliver Neukum <oneukum@suse.com> | 2022-04-28 15:34:55 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-05-13 11:02:23 +0200 |
commit | af2aa3c4e52bc63b532b55b1ac66f262ecff2fb3 (patch) | |
tree | 3cea291da9ddd07c3855ff45287121ce7930b732 /drivers/media/rc/imon.c | |
parent | media: imon: fix timer racing disconnect (diff) | |
download | linux-af2aa3c4e52bc63b532b55b1ac66f262ecff2fb3.tar.xz linux-af2aa3c4e52bc63b532b55b1ac66f262ecff2fb3.zip |
media: imon: drop references only after device is no longer used
The point of using get/put_device() is to keep references
for as long as the device may be in use. That means dropping
them must be the penultimate action right before freeing the memory.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r-- | drivers/media/rc/imon.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 8dbeab48ed3c..ad8bca8a8abd 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -2523,7 +2523,6 @@ static void imon_disconnect(struct usb_interface *interface) if (ifnum == 0) { ictx->dev_present_intf0 = false; usb_kill_urb(ictx->rx_urb_intf0); - usb_put_dev(ictx->usbdev_intf0); input_unregister_device(ictx->idev); rc_unregister_device(ictx->rdev); if (ictx->display_supported) { @@ -2532,14 +2531,15 @@ static void imon_disconnect(struct usb_interface *interface) else if (ictx->display_type == IMON_DISPLAY_TYPE_VFD) usb_deregister_dev(interface, &imon_vfd_class); } + usb_put_dev(ictx->usbdev_intf0); } else { ictx->dev_present_intf1 = false; usb_kill_urb(ictx->rx_urb_intf1); - usb_put_dev(ictx->usbdev_intf1); if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { del_timer_sync(&ictx->ttimer); input_unregister_device(ictx->touch); } + usb_put_dev(ictx->usbdev_intf1); } if (!ictx->dev_present_intf0 && !ictx->dev_present_intf1) |