OpenCloudOS-Kernel/drivers/media/radio/si470x
iceberg 2b97e2201e [media] double mutex lock in drivers/media/radio/si470x/radio-si470x-
KERNEL_VERSION: 2.6.37
common.c in function ssize_t si470x_fops_read.

1. First mutex_lock on &radio->lock in line 441
2. Second in line 462

I think that mutex in line 462 is not needed.

 433static ssize_t si470x_fops_read(struct file *file, char __user *buf,
 434                size_t count, loff_t *ppos)
 435{
....
 441        mutex_lock(&radio->lock);
 442        if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
 443                si470x_rds_on(radio);
 444
 445        /* block if no new data available */
 446        while (radio->wr_index == radio->rd_index) {
 447                if (file->f_flags & O_NONBLOCK) {
 448                        retval = -EWOULDBLOCK;
 449                        goto done;
 450                }
 451                if (wait_event_interruptible(radio->read_queue,
 452                        radio->wr_index != radio->rd_index) < 0) {
 453                        retval = -EINTR;
 454                        goto done;
 455                }
 456        }
 457
 458        /* calculate block count from byte count */
 459        count /= 3;
 460
 461        /* copy RDS block out of internal buffer and to user buffer */
 462        mutex_lock(&radio->lock);

Found by Linux Device Drivers Verification Project

Remove second mutex.

Signed-off-by: Alexander Strakh <strakh@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21 20:31:56 -03:00
..
Kconfig V4L/DVB (12416): radio-si470x: add i2c driver for si470x 2009-09-12 12:18:43 -03:00
Makefile V4L/DVB (12416): radio-si470x: add i2c driver for si470x 2009-09-12 12:18:43 -03:00
radio-si470x-common.c [media] double mutex lock in drivers/media/radio/si470x/radio-si470x- 2011-03-21 20:31:56 -03:00
radio-si470x-i2c.c V4L/DVB: v4l: radio: si470x: fix unneeded free_irq() call 2010-09-30 07:22:41 -03:00
radio-si470x-usb.c V4L/DVB: radio-si470x: remove the BKL lock used internally at the driver 2010-10-21 01:06:12 -02:00
radio-si470x.h [media] saa6588: rename rds.h to saa6588.h 2010-12-29 08:17:18 -02:00