diff options
author | Rong Chang <rongchang@chromium.org> | 2015-05-27 22:45:44 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-27 19:40:22 +0000 |
commit | a2075a54307249255c055067a33fdfbaa3b0f66c (patch) | |
tree | 30c5ff1176d2c993e70b123b2580c9009b971b03 /common | |
parent | 488f8c95651ad85edffff76af410a0fa85433242 (diff) | |
download | chrome-ec-a2075a54307249255c055067a33fdfbaa3b0f66c.tar.gz |
tcpm: return all non-zero errors
TCPM functions calls I2C read/write, which returns positive error codes
on stm32f0 based EC.
BRANCH=none
BUG=none
TEST=none
Change-Id: I8119074e7411e2fd88dd6ca696fc7b698d462623
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/273506
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_tcpm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/usb_pd_tcpm.c b/common/usb_pd_tcpm.c index 43f0bb8b98..b5b841c209 100644 --- a/common/usb_pd_tcpm.c +++ b/common/usb_pd_tcpm.c @@ -28,7 +28,7 @@ int tcpm_get_cc(int port, int *cc1, int *cc2) TCPC_REG_CC1_STATUS, &status); /* If i2c read fails, return error */ - if (rv < 0) + if (rv) return rv; *cc1 = TCPC_REG_CC_STATUS_VOLT(status & 0xff); @@ -93,7 +93,7 @@ int tcpm_get_message(int port, uint32_t *payload, int *head) TCPC_REG_RX_HDR, (int *)head); /* If i2c read fails, return error */ - if (rv < 0) + if (rv) return rv; if (cnt > 0) { @@ -122,7 +122,7 @@ int tcpm_transmit(int port, enum tcpm_transmit_type type, uint16_t header, TCPC_REG_TX_HDR, header); /* If i2c read fails, return error */ - if (rv < 0) + if (rv) return rv; if (cnt > 0) { @@ -135,7 +135,7 @@ int tcpm_transmit(int port, enum tcpm_transmit_type type, uint16_t header, } /* If i2c read fails, return error */ - if (rv < 0) + if (rv) return rv; rv = i2c_write8(I2C_PORT_TCPC, I2C_ADDR_TCPC(port), |