[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sexgaemn.fsf@jubnut.com>
Date: Thu, 13 Jun 2024 19:20:32 +0100
From: Ben Walsh <ben@...nut.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Benson Leung <bleung@...omium.org>, Tzung-Bi Shih <tzungbi@...nel.org>,
Guenter Roeck <groeck@...omium.org>, chrome-platform@...ts.linux.dev,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] platform/chrome: cros_ec_lpc: Fix error code in
cros_ec_lpc_mec_read_bytes()
Dan Carpenter <dan.carpenter@...aro.org> 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.
Powered by blists - more mailing lists