Skip to contentSkip to conversation

media: rc: ensure close() is called on rc_unregister_device

PATCH New Sean Young 1 participant 1 message Nov 6, 2018

Subsystems (2)
lore
Share & tools
lore

Sean Young

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 drivers/media/rc/rc-main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/rc/rc-main.c +2 -0
index 552bbe82a160..8863da4204a3 100644
@@ -1950,6 +1950,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);
 
Signature · 1 line
2.17.2