summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-11-06 11:25:16 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-11-06 11:25:16 -0200
commitde047e48990c47ec67694c6870ac6174972132cb (patch)
treebcfc333c2c20940f2304e792beb1c2084e8c5410 /linux/drivers
parent306604fa5dd4ae69145d9e75bd202801f3066e9c (diff)
downloadmediapointer-dvb-s2-de047e48990c47ec67694c6870ac6174972132cb.tar.gz
mediapointer-dvb-s2-de047e48990c47ec67694c6870ac6174972132cb.tar.bz2
Move check before lock
From: Roel Kluin <12o3l@tiscali.nl> 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 'linux/drivers')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/au6610.c6
-rw-r--r--linux/drivers/media/dvb/dvb-usb/gl861.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/au6610.c b/linux/drivers/media/dvb/dvb-usb/au6610.c
index 3314f8c0c..4800a5004 100644
--- a/linux/drivers/media/dvb/dvb-usb/au6610.c
+++ b/linux/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/linux/drivers/media/dvb/dvb-usb/gl861.c b/linux/drivers/media/dvb/dvb-usb/gl861.c
index 573d3520b..8f26ede0c 100644
--- a/linux/drivers/media/dvb/dvb-usb/gl861.c
+++ b/linux/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)) {