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
506{506{
507 struct irctl *ir = irctls[iminor(inode)];507 struct irctl *ir = irctls[iminor(inode)];
508 struct cdev *cdev;508 struct cdev *cdev;
509 int ret;
509 510
510 if (!ir) {511 if (!ir) {
511 printk(KERN_ERR "%s: called with invalid irctl\n", __func__);512 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
516 517
517 dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor);518 dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor);
518 519
519 WARN_ON(mutex_lock_killable(&lirc_dev_lock));520 ret = mutex_lock_killable(&lirc_dev_lock);
521 WARN_ON(ret);
520 522
521 rc_close(ir->d.rdev);523 rc_close(ir->d.rdev);
522 524
@@ -532,7 +534,8 @@ int lirc_dev_fop_close(struct inode *inode, struct file *file) · 9 unmodified lines
532 kfree(ir);534 kfree(ir);
533 }535 }
534 536
535 mutex_unlock(&lirc_dev_lock);537 if (!ret)
538 mutex_unlock(&lirc_dev_lock);
536 539
537 return 0;540 return 0;
538}541}

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