diff options
author | Roel Kluin <12o3l@tiscali.nl> | 2007-11-06 08:25:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:02:02 -0500 |
commit | c80296d755df29167deafa53e612644a95b40c6e (patch) | |
tree | bb52bc73662c1fe689aad72544de31c9a1695c6a | |
parent | bbe1e0ba527a18e1ddda2eabb9da369e5bcf556e (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>
-rw-r--r-- | drivers/media/dvb/dvb-usb/au6610.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/gl861.c | 6 |
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[], | |||
79 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 79 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
80 | int i; | 80 | int i; |
81 | 81 | ||
82 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
83 | return -EAGAIN; | ||
84 | |||
85 | if (num > 2) | 82 | if (num > 2) |
86 | return -EINVAL; | 83 | return -EINVAL; |
87 | 84 | ||
85 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
86 | return -EAGAIN; | ||
87 | |||
88 | for (i = 0; i < num; i++) { | 88 | for (i = 0; i < num; i++) { |
89 | /* write/read request */ | 89 | /* write/read request */ |
90 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 90 | 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[], | |||
56 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 56 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
57 | int i; | 57 | int i; |
58 | 58 | ||
59 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
60 | return -EAGAIN; | ||
61 | |||
62 | if (num > 2) | 59 | if (num > 2) |
63 | return -EINVAL; | 60 | return -EINVAL; |
64 | 61 | ||
62 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
63 | return -EAGAIN; | ||
64 | |||
65 | for (i = 0; i < num; i++) { | 65 | for (i = 0; i < num; i++) { |
66 | /* write/read request */ | 66 | /* write/read request */ |
67 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 67 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { |