Skip to content

Commit

Permalink
V4L/DVB (6564): Move check before lock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent bbe1e0b commit c80296d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions drivers/media/dvb/dvb-usb/au6610.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/dvb/dvb-usb/gl861.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit c80296d

Please sign in to comment.