summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRoel Kluin <12o3l@tiscali.nl>2007-11-06 10:25:16 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 19:02:02 -0200
commitc80296d755df29167deafa53e612644a95b40c6e (patch)
treebb52bc73662c1fe689aad72544de31c9a1695c6a /drivers
parentbbe1e0ba527a18e1ddda2eabb9da369e5bcf556e (diff)
V4L/DVB (6564): Move check before lock
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.c6
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c
index 18e0b16fb2a9..f3ff81314696 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -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)) {
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index f01d99c1c43c..6b99d9f4d5b3 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -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)) {