* [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write
@ 2024-06-13 21:25 Ben Walsh
2024-06-14 2:50 ` patchwork-bot+chrome-platform
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ben Walsh @ 2024-06-13 21:25 UTC (permalink / raw)
To: Dan Carpenter, Benson Leung, Tzung-Bi Shih, Guenter Roeck,
chrome-platform, linux-kernel, kernel-janitors
Cc: Ben Walsh
cros_ec_lpc_mec_read_bytes and cros_ec_lpc_mec_write_bytes call
cros_ec_lpc_mec_in_range, which checks if addresses are in the MEC
address range, and returns -EINVAL if the range given is not sensible.
However cros_ec_lpc_mec_in_range was also returning -EINVAL for a zero
length range.
A zero length range should not be an error condition.
cros_ec_lpc_mec_in_range now returns 1 in this case.
cros_ec_lpc_io_bytes_mec checks for zero length, and returns
immediately without beginning a transfer.
Signed-off-by: Ben Walsh <ben@jubnut.com>
---
drivers/platform/chrome/cros_ec_lpc_mec.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_lpc_mec.c b/drivers/platform/chrome/cros_ec_lpc_mec.c
index dfad934e65ca..a56584171168 100644
--- a/drivers/platform/chrome/cros_ec_lpc_mec.c
+++ b/drivers/platform/chrome/cros_ec_lpc_mec.c
@@ -93,9 +93,6 @@ static void cros_ec_lpc_mec_emi_write_address(u16 addr,
*/
int cros_ec_lpc_mec_in_range(unsigned int offset, unsigned int length)
{
- if (length == 0)
- return -EINVAL;
-
if (WARN_ON(mec_emi_base == 0 || mec_emi_end == 0))
return -EINVAL;
@@ -132,6 +129,9 @@ int cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
enum cros_ec_lpc_mec_emi_access_mode access, new_access;
int ret;
+ if (length == 0)
+ return 0;
+
/* Return checksum of 0 if window is not initialized */
WARN_ON(mec_emi_base == 0 || mec_emi_end == 0);
if (mec_emi_base == 0 || mec_emi_end == 0)
base-commit: 77a714325d09e1527d865dc011ef91c4972ffedd
--
2.45.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write
2024-06-13 21:25 [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write Ben Walsh
@ 2024-06-14 2:50 ` patchwork-bot+chrome-platform
2024-06-14 2:50 ` patchwork-bot+chrome-platform
2024-06-14 5:05 ` Dan Carpenter
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+chrome-platform @ 2024-06-14 2:50 UTC (permalink / raw)
To: Ben Walsh
Cc: dan.carpenter, bleung, tzungbi, groeck, chrome-platform,
linux-kernel, kernel-janitors
Hello:
This patch was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:
On Thu, 13 Jun 2024 22:25:42 +0100 you wrote:
> cros_ec_lpc_mec_read_bytes and cros_ec_lpc_mec_write_bytes call
> cros_ec_lpc_mec_in_range, which checks if addresses are in the MEC
> address range, and returns -EINVAL if the range given is not sensible.
>
> However cros_ec_lpc_mec_in_range was also returning -EINVAL for a zero
> length range.
>
> [...]
Here is the summary with links:
- platform/chrome: cros_ec_lpc: Handle zero length read/write
https://git.kernel.org/chrome-platform/c/b57cd5703a16
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write
2024-06-13 21:25 [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write Ben Walsh
2024-06-14 2:50 ` patchwork-bot+chrome-platform
@ 2024-06-14 2:50 ` patchwork-bot+chrome-platform
2024-06-14 5:05 ` Dan Carpenter
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+chrome-platform @ 2024-06-14 2:50 UTC (permalink / raw)
To: Ben Walsh
Cc: dan.carpenter, bleung, tzungbi, groeck, chrome-platform,
linux-kernel, kernel-janitors
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:
On Thu, 13 Jun 2024 22:25:42 +0100 you wrote:
> cros_ec_lpc_mec_read_bytes and cros_ec_lpc_mec_write_bytes call
> cros_ec_lpc_mec_in_range, which checks if addresses are in the MEC
> address range, and returns -EINVAL if the range given is not sensible.
>
> However cros_ec_lpc_mec_in_range was also returning -EINVAL for a zero
> length range.
>
> [...]
Here is the summary with links:
- platform/chrome: cros_ec_lpc: Handle zero length read/write
https://git.kernel.org/chrome-platform/c/b57cd5703a16
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write
2024-06-13 21:25 [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write Ben Walsh
2024-06-14 2:50 ` patchwork-bot+chrome-platform
2024-06-14 2:50 ` patchwork-bot+chrome-platform
@ 2024-06-14 5:05 ` Dan Carpenter
2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-06-14 5:05 UTC (permalink / raw)
To: Ben Walsh
Cc: Benson Leung, Tzung-Bi Shih, Guenter Roeck, chrome-platform,
linux-kernel, kernel-janitors
On Thu, Jun 13, 2024 at 10:25:42PM +0100, Ben Walsh wrote:
> cros_ec_lpc_mec_read_bytes and cros_ec_lpc_mec_write_bytes call
> cros_ec_lpc_mec_in_range, which checks if addresses are in the MEC
> address range, and returns -EINVAL if the range given is not sensible.
>
> However cros_ec_lpc_mec_in_range was also returning -EINVAL for a zero
> length range.
>
> A zero length range should not be an error condition.
> cros_ec_lpc_mec_in_range now returns 1 in this case.
> cros_ec_lpc_io_bytes_mec checks for zero length, and returns
> immediately without beginning a transfer.
>
> Signed-off-by: Ben Walsh <ben@jubnut.com>
Ideally this would have a Fixes tag that points to my commit.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-14 5:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 21:25 [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write Ben Walsh
2024-06-14 2:50 ` patchwork-bot+chrome-platform
2024-06-14 2:50 ` patchwork-bot+chrome-platform
2024-06-14 5:05 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox