Skip to content

Commit

Permalink
[media] media: em28xx - fix i2c_xfer to return -ENODEV when dev is re…
Browse files Browse the repository at this point in the history
…moved

In em28xx usb disconnect code path, some dvb fe and tuner drivers
attempt i2c transfers from their release interfaces. When device
is removed, return -ENODEV instead of attempting to transfer data
over i2c.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
  • Loading branch information
Shuah Khan authored and Mauro Carvalho Chehab committed Jul 26, 2014
1 parent b89193e commit cc5c5d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/usb/em28xx/em28xx-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,12 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
int addr, rc, i;
u8 reg;

/* prevent i2c xfer attempts after device is disconnected
some fe's try to do i2c writes/reads from their release
interfaces when called in disconnect path */
if (dev->disconnected)
return -ENODEV;

rc = rt_mutex_trylock(&dev->i2c_bus_lock);
if (rc < 0)
return rc;
Expand Down

0 comments on commit cc5c5d2

Please sign in to comment.