History

[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'

Mauro Carvalho Chehab committed 10 years ago

Commit b64e10f1 parent fe28f5d1 file · +5 −2Browse files

Unified · Split

drivers/media/rc/lirc_dev.c+5−2
@@ -506,6 +506,7 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) · 505 unmodified lines
506506 {
507507 struct irctl *ir = irctls[iminor(inode)];
508508 struct cdev *cdev;
509+ int ret;
509510
510511 if (!ir) {
511512 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) · 4 unmodified lines
516517
517518 dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor);
518519
519− WARN_ON(mutex_lock_killable(&lirc_dev_lock));
520+ ret = mutex_lock_killable(&lirc_dev_lock);
521+ WARN_ON(ret);
520522
521523 rc_close(ir->d.rdev);
522524
@@ -532,7 +534,8 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) · 9 unmodified lines
532534 kfree(ir);
533535 }
534536
535− mutex_unlock(&lirc_dev_lock);
537+ if (!ret)
538+ mutex_unlock(&lirc_dev_lock);
536539
537540 return 0;
538541 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t