Commit 1970105a authored by Brad Love's avatar Brad Love Committed by Mauro Carvalho Chehab

media: em28xx-core: Fix i2c error debug

Read errors are currently reported as write errors.

An incorrectly received read operation is never reported at all.
Add a debug statement indicating the request mismatch.
Signed-off-by: default avatarBrad Love <brad@nextdimension.cc>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 688e2dd4
...@@ -294,6 +294,10 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) ...@@ -294,6 +294,10 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
"reading from i2c device at 0x%x failed (error=%i)\n", "reading from i2c device at 0x%x failed (error=%i)\n",
addr, ret); addr, ret);
return ret; return ret;
} else if (ret != len) {
dev_dbg(&dev->intf->dev,
"%i bytes read from i2c device at 0x%x requested, but %i bytes written\n",
ret, addr, len);
} }
/* /*
* NOTE: some devices with two i2c buses have the bad habit to return 0 * NOTE: some devices with two i2c buses have the bad habit to return 0
...@@ -329,7 +333,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) ...@@ -329,7 +333,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
} }
dev_warn(&dev->intf->dev, dev_warn(&dev->intf->dev,
"write to i2c device at 0x%x failed with unknown error (status=%i)\n", "read from i2c device at 0x%x failed with unknown error (status=%i)\n",
addr, ret); addr, ret);
return -EIO; return -EIO;
} }
......
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