diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-05-25 15:03:26 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-28 22:46:30 -0700 |
commit | b73431f6733225799d0519966dc79fdf226f61a8 (patch) | |
tree | 04c7c5e767f35c6b632570d5188730c877f2c302 | |
parent | 49ff62bf0be5cfc88e092f987d77c18a0b21390a (diff) | |
download | chrome-ec-b73431f6733225799d0519966dc79fdf226f61a8.tar.gz |
usb_pd_protocol: Only print TCPC info if available
tcpm_get_chip_info does not modify the parameter info if the
function is not implemented on the given chip.
This has a interesting side effect on Kevin, where, for whatever
reason, info's value ends up being 1, and causes unaligned access
exception:
[0.039 TCPC p0 init ready]
=== PROCESS EXCEPTION: 06 ====== xPSR: 61000000 ===
r0 :00000000 r1 :28000000 r2 :00000001 r3 :00000000
r4 :00000000 r5 :00000000 r6 :00000000 r7 :00000000
r8 :200c60f4 r9 :00000000 r10:100c0c3c r11:00000000
r12:200c52ed sp :200c5320 lr :100a9c71 pc :100abd5a
Unaligned
mmfs = 1000000, shcsr = 70008, hfsr = 0, dfsr = 0
BRANCH=none
BUG=none
TEST=On ToT make BOARD=kevin -j; flash, kevin boots
Change-Id: Ie7e758d5fb8c31180f36b073b635e54cc720a8a0
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1073179
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 180f353a4d..07268fc310 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2196,10 +2196,12 @@ void pd_task(void *u) #ifndef CONFIG_USB_PD_TCPC if (!res) { struct ec_response_pd_chip_info *info; - tcpm_get_chip_info(port, 0, &info); - CPRINTS("TCPC p%d VID:0x%x PID:0x%x DID:0x%x FWV:0x%lx", - port, info->vendor_id, info->product_id, - info->device_id, info->fw_version_number); + + if (tcpm_get_chip_info(port, 0, &info) == EC_SUCCESS) { + CPRINTS("TCPC p%d VID:0x%x PID:0x%x DID:0x%x FWV:0x%lx", + port, info->vendor_id, info->product_id, + info->device_id, info->fw_version_number); + } } #endif |