Dan Carpenter <dan.carpenter@xxxxxxxxxx> writes: > On Thu, Jun 13, 2024 at 05:51:39PM +0100, Ben Walsh wrote: >> >> Thanks for fixing this! Unfortunately `in_range` returns -EINVAL if >> length == 0 (see the definition of `fwk_ec_lpc_mec_in_range`). I'm sure >> this broke something in my testing, but I can't find what it was now. > > I don't think fwk_ec_lpc_mec_in_range() is upstream. This email is the > only reference I can find to it on the internet. Sorry, I mean cros_ec_lpc_mec_in_range(). > int cros_ec_lpc_mec_in_range(unsigned int offset, unsigned int length) > { > if (length == 0) > - return -EINVAL; > + return 0; > > if (WARN_ON(mec_emi_base == 0 || mec_emi_end == 0)) > return -EINVAL; > > But I don't like how subtle that is. Probably adding a check for > for if (length == 0) to the to cros_ec_lpc_mec_read_bytes() seems > like the best option. I guess option 2 is the best option. Thanks. I'll check out Tzung-Bi's suggestions as well before we decide.