Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 68dbac0a58ef ("platform/chrome: cros_ec_lpc: MEC access can return error code")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Link: https://lore.kernel.org/r/e0b43fb5-ecc8-4fb4-9b76-c06dea8cc4c4@moroto.mountain
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>

authored by

Dan Carpenter and committed by
Tzung-Bi Shih
77a71432 c2a28647

+2 -2
+2 -2
drivers/platform/chrome/cros_ec_lpc.c
··· 139 139 int in_range = cros_ec_lpc_mec_in_range(offset, length); 140 140 141 141 if (in_range < 0) 142 - return 0; 142 + return in_range; 143 143 144 144 return in_range ? 145 145 cros_ec_lpc_io_bytes_mec(MEC_IO_READ, ··· 158 158 int in_range = cros_ec_lpc_mec_in_range(offset, length); 159 159 160 160 if (in_range < 0) 161 - return 0; 161 + return in_range; 162 162 163 163 return in_range ? 164 164 cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE,