Re: [PATCH] platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()

From: Tzung-Bi Shih
Date: Thu Jun 13 2024 - 22:21:25 EST


On Thu, Jun 13, 2024 at 08:14:14PM +0100, Ben Walsh wrote:
> Tzung-Bi Shih <tzungbi@xxxxxxxxxx> writes:
> > On Thu, Jun 13, 2024 at 05:51:39PM +0100, Ben Walsh wrote:
> >> or 2. Put in a check for length == 0.
> >>
> >> or 3. Change the logic in `fwk_ec_lpc_mec_in_range`. Although I'm not
> >> sure what the correct answer is to "zero length is in range?"
> >>
> >> I prefer option 2. What do you think?
> >
> > How about drop the length check at [2]?
> >
> > [2]: https://elixir.bootlin.com/linux/v6.9/source/drivers/platform/chrome/cros_ec_lpc_mec.c#L44
> >
>
> This works, but we still end up calling cros_ec_lpc_io_bytes_mec() with
> zero length. Although this seems to work fine, we could put a length
> check at the top of cros_ec_lpc_read_bytes() to avoid it.

I guess you mean: cros_ec_lpc_io_bytes_mec(). Ack.