diff mbox series

[i2c-tools] Revert "tools: i2ctransfer: add check for returned length from driver"

Message ID 20210209110556.18814-1-wsa+renesas@sang-engineering.com
State New
Headers show
Series [i2c-tools] Revert "tools: i2ctransfer: add check for returned length from driver" | expand

Commit Message

Wolfram Sang Feb. 9, 2021, 11:05 a.m. UTC
This reverts commit 34806fc4e7090b34e32fa1110d546ab5ce01a6a0. It was
developed against an experimental kernel. The regular kernel does not
update the new message length to userspace, so the check is always false
positive. We can't change the kernel behaviour because it would break
the ABI. So revert this commit.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Very embarrasing :( I am sorry for this. Jean, maybe this is worth a
4.2.1. release?

 tools/i2ctransfer.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Jean Delvare Feb. 26, 2021, 4:43 p.m. UTC | #1
Hi Wolfram,

On Tue,  9 Feb 2021 12:05:56 +0100, Wolfram Sang wrote:
> This reverts commit 34806fc4e7090b34e32fa1110d546ab5ce01a6a0. It was
> developed against an experimental kernel. The regular kernel does not
> update the new message length to userspace, so the check is always false
> positive. We can't change the kernel behaviour because it would break
> the ABI. So revert this commit.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Very embarrasing :( I am sorry for this. Jean, maybe this is worth a
> 4.2.1. release?

Sorry for not catching this, I must say I did not remember exactly what
the API was supposed to be, and I did not have any device to test the
change.

We don't usually do minor version updates for bug fixes. Instead, what
I do is maintain a list of such "must have" fixes, that package
maintainers can refer to. Look for "Recommended patches" at:

https://i2c.wiki.kernel.org/index.php/I2C_Tools

There's no section for version 4.2 yet, but we can add one as soon as
the commit hits the public repository.
diff mbox series

Patch

diff --git a/tools/i2ctransfer.c b/tools/i2ctransfer.c
index f2a4df8..b0e8d43 100644
--- a/tools/i2ctransfer.c
+++ b/tools/i2ctransfer.c
@@ -88,12 +88,7 @@  static void print_msgs(struct i2c_msg *msgs, __u32 nmsgs, unsigned flags)
 		int recv_len = msgs[i].flags & I2C_M_RECV_LEN;
 		int print_buf = (read && (flags & PRINT_READ_BUF)) ||
 				(!read && (flags & PRINT_WRITE_BUF));
-		__u16 len = msgs[i].len;
-
-		if (recv_len && print_buf && len != msgs[i].buf[0] + 1) {
-			fprintf(stderr, "Correcting wrong msg length after recv_len! Please fix the I2C driver and/or report.\n");
-			len = msgs[i].buf[0] + 1;
-		}
+		__u16 len = recv_len ? msgs[i].buf[0] + 1 : msgs[i].len;
 
 		if (flags & PRINT_HEADER) {
 			fprintf(output, "msg %u: addr 0x%02x, %s, len ",