diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2014-11-06 14:17:43 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-17 16:34:16 +0000 |
commit | 5fad6d4b8c0958f7d2a795215b31c22235babb45 (patch) | |
tree | e6a4ac5cda90ae4c3d9b42ae11c403c609fd6d46 /util/comm-lpc.c | |
parent | 1d4c619a0afa9e69f5ae571e34e348d0598b023b (diff) | |
download | chrome-ec-5fad6d4b8c0958f7d2a795215b31c22235babb45.tar.gz |
util: Fix return value of ec_command
When ec_command fails because of transport issue,
it should returns an error between -1 and -EECRESULT.
If the command fails because of the EC, the error should be less
than -EECRESULT.
Unify all transports to return the error in the same manner.
BRANCH=ToT
BUG=None
TEST=Samus: Check that unsupported command fails with the correct error
number over dev transport.
Qwarks: Check the same command with a 3.10 kernel (no dev transport,
just LPC) fails with the same error code.
Change-Id: I2e43d0cb003d75318b0edd3745e534c700d7d7d8
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/228295
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'util/comm-lpc.c')
-rw-r--r-- | util/comm-lpc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/comm-lpc.c b/util/comm-lpc.c index 06912af1f2..e7c5a25b55 100644 --- a/util/comm-lpc.c +++ b/util/comm-lpc.c @@ -83,7 +83,7 @@ static int ec_command_lpc(int command, int version, i = inb(EC_LPC_ADDR_HOST_DATA); if (i) { fprintf(stderr, "EC returned error result code %d\n", i); - return -i; + return -EECRESULT - i; } /* Read back args */ @@ -178,7 +178,7 @@ static int ec_command_lpc_3(int command, int version, i = inb(EC_LPC_ADDR_HOST_DATA); if (i) { fprintf(stderr, "EC returned error result code %d\n", i); - return -i; + return -EECRESULT - i; } /* Read back response header and start checksum */ |