diff options
author | Devin Heitmueller <dheitmueller@kernellabs.com> | 2012-08-06 22:46:58 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-09 20:34:16 -0300 |
commit | 549ee4df1951c8a1a123e81a073d73c2e1c26588 (patch) | |
tree | a200ea038a0389b6214bea7ff3b1d7d503921e1a /drivers/media/video/au0828/au0828-core.c | |
parent | [media] xc5000: properly report i2c write failures (diff) | |
download | linux-dev-549ee4df1951c8a1a123e81a073d73c2e1c26588.tar.xz linux-dev-549ee4df1951c8a1a123e81a073d73c2e1c26588.zip |
[media] au0828: fix race condition that causes xc5000 to not bind for digital
In some cases users would see the xc5000_attach() call failing for the
digital side of the tuner on initialization. This is because of udev
running v4l-id while the digital side of the board is still coming up.
This is the exact same race condition which was present in em28xx (not
surprising since I copied all the locking logic from that driver when I
added analog support). Reproduce Mauro's fix from the em28xx driver in
au0828.
Reported-by: Rick Harding <rharding@mitechie.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828/au0828-core.c')
-rw-r--r-- | drivers/media/video/au0828/au0828-core.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c index 1e4ce5068ec2..b2c4254e6ec3 100644 --- a/drivers/media/video/au0828/au0828-core.c +++ b/drivers/media/video/au0828/au0828-core.c @@ -205,6 +205,8 @@ static int au0828_usb_probe(struct usb_interface *interface, return -ENOMEM; } + mutex_init(&dev->lock); + mutex_lock(&dev->lock); mutex_init(&dev->mutex); mutex_init(&dev->dvb.lock); dev->usbdev = usbdev; @@ -215,6 +217,7 @@ static int au0828_usb_probe(struct usb_interface *interface, if (retval) { printk(KERN_ERR "%s() v4l2_device_register failed\n", __func__); + mutex_unlock(&dev->lock); kfree(dev); return -EIO; } @@ -245,6 +248,8 @@ static int au0828_usb_probe(struct usb_interface *interface, printk(KERN_INFO "Registered device AU0828 [%s]\n", dev->board.name == NULL ? "Unset" : dev->board.name); + mutex_unlock(&dev->lock); + return 0; } |