summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/comm-i2c.c4
-rw-r--r--util/comm-lpc.c4
-rw-r--r--util/comm-mec1322.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/util/comm-i2c.c b/util/comm-i2c.c
index aa1e4f64d8..0631220caf 100644
--- a/util/comm-i2c.c
+++ b/util/comm-i2c.c
@@ -140,8 +140,8 @@ static int ec_command_i2c(int command, int version,
if (ret) {
debug("command 0x%02x returned an error %d\n",
command, i2c_msg[1].buf[0]);
- /* Translate ERROR to -ERROR */
- ret = -ret;
+ /* Translate ERROR to -ERROR and offset */
+ ret = -EECRESULT - ret;
} else if (insize) {
debug("i2c resp :");
/* copy response packet payload and compute checksum */
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 */
diff --git a/util/comm-mec1322.c b/util/comm-mec1322.c
index 70e4f3ff89..61c93e184b 100644
--- a/util/comm-mec1322.c
+++ b/util/comm-mec1322.c
@@ -148,7 +148,7 @@ static int ec_command_lpc(int command, int version,
i = read_byte(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 */
@@ -236,7 +236,7 @@ static int ec_command_lpc_3(int command, int version,
i = read_byte(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 */