[PATCH] char: tlclk: clear useflags when request_irq() fails

Li Youhong posted 1 patch 4 weeks, 1 day ago
drivers/char/tlclk.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] char: tlclk: clear useflags when request_irq() fails
Posted by Li Youhong 4 weeks, 1 day ago
From: Li Youhong <liyouhong@kylinos.cn>

If request_irq() fails after the exclusive open bit is set, clear the
bit so a subsequent open() is not permanently rejected with -EBUSY.

Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
---
 drivers/char/tlclk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 255f69123af5..355f68d7bf4d 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -228,6 +228,9 @@ static int tlclk_open(struct inode *inode, struct file *filp)
 	else
 		inb(TLCLK_REG6);	/* Clear interrupt events */
 
+	if (result)
+		clear_bit(0, &useflags);
+
 out:
 	mutex_unlock(&tlclk_mutex);
 	return result;
-- 
2.25.1