Commit c05b6f0a authored by Dan Carpenter's avatar Dan Carpenter Committed by Willy Tarreau

em28xx-i2c: rt_mutex_trylock() returns zero on failure

commit e44c153b upstream.

The code is checking for negative returns but it should be checking for
zero.

Fixes: aab3125c ('[media] em28xx: add support for registering multiple i2c buses')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 24e4e002
......@@ -469,9 +469,8 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
int addr, rc, i;
u8 reg;
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 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment