mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 06:02:38 +00:00
[media] em28xx-i2c: rt_mutex_trylock() returns zero on failure
The code is checking for negative returns but it should be checking for
zero.
Fixes: aab3125c43
('[media] em28xx: add support for registering multiple i2c buses')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
917d11a4e0
commit
e44c153b30
@ -507,9 +507,8 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
if (dev->disconnected)
|
||||
return -ENODEV;
|
||||
|
||||
rc = rt_mutex_trylock(&dev->i2c_bus_lock);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (!rt_mutex_trylock(&dev->i2c_bus_lock))
|
||||
return -EAGAIN;
|
||||
|
||||
/* Switch I2C bus if needed */
|
||||
if (bus != dev->cur_i2c_bus &&
|
||||
|
Loading…
Reference in New Issue
Block a user