Messages in this thread | | | Date | Fri, 1 Apr 2022 18:29:43 +0200 | From | Wolfram Sang <> | 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.
[unhandled content-type:application/pgp-signature] | |