Skip to content

Commit

Permalink
media: em28xx-core: Fix i2c error debug
Browse files Browse the repository at this point in the history
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: Brad Love <brad@nextdimension.cc>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Brad Love authored and Mauro Carvalho Chehab committed Feb 5, 2021
1 parent 688e2dd commit 1970105
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/media/usb/em28xx/em28xx-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
addr, 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
Expand Down Expand Up @@ -329,7 +333,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
}

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);
return -EIO;
}
Expand Down

0 comments on commit 1970105

Please sign in to comment.