]> err.no Git - linux-2.6/commitdiff
V4L/DVB (6564): Move check before lock
authorRoel Kluin <12o3l@tiscali.nl>
Tue, 6 Nov 2007 13:25:16 +0000 (10:25 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:02:02 +0000 (19:02 -0200)
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
CC: Antti Palosaari <crope@iki.fi>
CC: Carl Lundqvist <comabug@gmail.com>
CC: Aapo Tahkola <aet@rasterburn.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/dvb-usb/au6610.c
drivers/media/dvb/dvb-usb/gl861.c

index 18e0b16fb2a9ce012109809c0ae8bc15545f9e94..f3ff8131469607422e2599b88492521bac9e3f78 100644 (file)
@@ -79,12 +79,12 @@ static int au6610_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
        struct dvb_usb_device *d = i2c_get_adapdata(adap);
        int i;
 
-       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
-               return -EAGAIN;
-
        if (num > 2)
                return -EINVAL;
 
+       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+               return -EAGAIN;
+
        for (i = 0; i < num; i++) {
                /* write/read request */
                if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
index f01d99c1c43c12ebef10a3729c1c5ff15b9a23ec..6b99d9f4d5b35846892f023998d903aafdc8caa5 100644 (file)
@@ -56,12 +56,12 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
        struct dvb_usb_device *d = i2c_get_adapdata(adap);
        int i;
 
-       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
-               return -EAGAIN;
-
        if (num > 2)
                return -EINVAL;
 
+       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+               return -EAGAIN;
+
        for (i = 0; i < num; i++) {
                /* write/read request */
                if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {