chrome-platform.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()
@ 2024-06-13 13:55 Dan Carpenter
  2024-06-13 14:02 ` Guenter Roeck
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Dan Carpenter @ 2024-06-13 13:55 UTC (permalink / raw)
  To: Ben Walsh
  Cc: Benson Leung, Tzung-Bi Shih, Guenter Roeck, chrome-platform,
	linux-kernel, kernel-janitors

We changed these functions to returning negative error codes, but this
first error path was accidentally overlooked.  It leads to a Smatch
warning:

    drivers/platform/chrome/cros_ec_lpc.c:181 ec_response_timed_out()
    error: uninitialized symbol 'data'.

Fix this by returning the error code instead of success.

Fixes: 68dbac0a58ef ("platform/chrome: cros_ec_lpc: MEC access can return error code")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/platform/chrome/cros_ec_lpc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index ebe9fb143840..f0470248b109 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -139,7 +139,7 @@ static int cros_ec_lpc_mec_read_bytes(unsigned int offset, unsigned int length,
 	int in_range = cros_ec_lpc_mec_in_range(offset, length);
 
 	if (in_range < 0)
-		return 0;
+		return in_range;
 
 	return in_range ?
 		cros_ec_lpc_io_bytes_mec(MEC_IO_READ,
@@ -158,7 +158,7 @@ static int cros_ec_lpc_mec_write_bytes(unsigned int offset, unsigned int length,
 	int in_range = cros_ec_lpc_mec_in_range(offset, length);
 
 	if (in_range < 0)
-		return 0;
+		return in_range;
 
 	return in_range ?
 		cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-06-14  2:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 13:55 [PATCH] platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes() Dan Carpenter
2024-06-13 14:02 ` Guenter Roeck
2024-06-13 15:20 ` patchwork-bot+chrome-platform
2024-06-13 15:20 ` patchwork-bot+chrome-platform
2024-06-13 16:51 ` Ben Walsh
2024-06-13 17:40   ` Tzung-Bi Shih
2024-06-13 19:14     ` Ben Walsh
2024-06-14  2:21       ` Tzung-Bi Shih
2024-06-13 19:19     ` Ben Walsh
2024-06-13 17:57   ` Dan Carpenter
2024-06-13 18:20     ` Ben Walsh
2024-06-13 18:34       ` Dan Carpenter
2024-06-13 20:50         ` Ben Walsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).