Skip to content

Commit 77a7143

Browse files
Dan CarpenterTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()
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: 68dbac0 ("platform/chrome: cros_ec_lpc: MEC access can return error code") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tzung-Bi Shih <[email protected]>
1 parent c2a2864 commit 77a7143

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static int cros_ec_lpc_mec_read_bytes(unsigned int offset, unsigned int length,
139139
int in_range = cros_ec_lpc_mec_in_range(offset, length);
140140

141141
if (in_range < 0)
142-
return 0;
142+
return in_range;
143143

144144
return in_range ?
145145
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,
158158
int in_range = cros_ec_lpc_mec_in_range(offset, length);
159159

160160
if (in_range < 0)
161-
return 0;
161+
return in_range;
162162

163163
return in_range ?
164164
cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE,

0 commit comments

Comments
 (0)