Commit b64e10f3 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] lirc_dev: avoid double mutex unlock

We can only unlock if mutex_lock() succeeds.

Fixes the following warning:
	drivers/media/rc/lirc_dev.c:535 lirc_dev_fop_close() error: double unlock 'mutex:&lirc_dev_lock'
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent fe28f5de
...@@ -506,6 +506,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) ...@@ -506,6 +506,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file)
{ {
struct irctl *ir = irctls[iminor(inode)]; struct irctl *ir = irctls[iminor(inode)];
struct cdev *cdev; struct cdev *cdev;
int ret;
if (!ir) { if (!ir) {
printk(KERN_ERR "%s: called with invalid irctl\n", __func__); printk(KERN_ERR "%s: called with invalid irctl\n", __func__);
...@@ -516,7 +517,8 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) ...@@ -516,7 +517,8 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file)
dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor); dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor);
WARN_ON(mutex_lock_killable(&lirc_dev_lock)); ret = mutex_lock_killable(&lirc_dev_lock);
WARN_ON(ret);
rc_close(ir->d.rdev); rc_close(ir->d.rdev);
...@@ -532,7 +534,8 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) ...@@ -532,7 +534,8 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file)
kfree(ir); kfree(ir);
} }
mutex_unlock(&lirc_dev_lock); if (!ret)
mutex_unlock(&lirc_dev_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment