[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ykcod/XOYvGfUsga@ninjato>
Date: Fri, 1 Apr 2022 18:29:43 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: "Gabbasov, Andrew" <Andrew_Gabbasov@...tor.com>
Cc: "linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
"Surachari, Bhuvanesh" <Bhuvanesh_Surachari@...tor.com>
Subject: Re: [PATCH v2] i2c: rcar: add SMBus block read support
> > /* If next received data is the _LAST_, go to new phase. */
> > - if (priv->pos + 1 == msg->len) {
> > + if (priv->pos + 1 == msg->len && !recv_len_init) {
>
> If a message contains a single byte after the length byte,
> when we come here after processing the length (in the same function call),
> "pos" is 1, "len" is 2, and we indeed are going to process the last byte.
> However, "recv_len_init" is still "true", and we skip these corresponding
> register writes, which is probably incorrect.
> The flag in this case should be re-set back to "false" after length
> processing and "pos" moving, but I think the variant in my patch
Confirmed. Tests fail with only one extra byte and clearing
'recv_len_init' fixes the issue. I don't think this is the proper
solution, though. I think it will create more readable code if we update
the checks. So people will understand what we are aiming for. The
current code is already implicit enough.
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists