aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-main.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2018-11-04 05:12:09 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-11-22 13:33:24 -0500
commit8e782fcf78275f505194e767c515202d4fd274bc (patch)
tree61e03f7ed3d1b206976bc43cc9c8b30def235935 /drivers/media/rc/rc-main.c
parentmedia: rc: imon: replace strcpy() by strscpy() (diff)
downloadlinux-dev-8e782fcf78275f505194e767c515202d4fd274bc.tar.xz
linux-dev-8e782fcf78275f505194e767c515202d4fd274bc.zip
media: rc: ensure close() is called on rc_unregister_device
If userspace has an open file descriptor on the rc input device or lirc device when rc_unregister_device() is called, then the rc close() is never called. This ensures that the receiver is turned off on the nuvoton-cir driver during shutdown. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/rc/rc-main.c')
-rw-r--r--drivers/media/rc/rc-main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 877978dbd409..66a174979b3c 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1952,6 +1952,8 @@ void rc_unregister_device(struct rc_dev *dev)
rc_free_rx_device(dev);
mutex_lock(&dev->lock);
+ if (dev->users && dev->close)
+ dev->close(dev);
dev->registered = false;
mutex_unlock(&dev->lock);