summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2019-01-16 08:44:24 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-16 19:03:57 +0000
commit63e265bf4fe2f25cafa57070098b52df1899b71f (patch)
treeabd6043c5f826830f7e49c99672e204f11354d4c
parent932cd8039bcb20f5dd2b257f4382b7c2f32442f5 (diff)
downloadchrome-ec-63e265bf4fe2f25cafa57070098b52df1899b71f.tar.gz
This patch makes ectool check the address of comm_init_lpc and comm_init_i2c before calling them. Related bug:b/35571850 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/122478187 BRANCH=none TEST=buildall Change-Id: I32499174d7f82e45941cd97cf7780ea04517115f Reviewed-on: https://chromium-review.googlesource.com/c/1414032 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--util/comm-host.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/comm-host.c b/util/comm-host.c
index f8be25294c..e020cf8840 100644
--- a/util/comm-host.c
+++ b/util/comm-host.c
@@ -95,11 +95,13 @@ int comm_init_alt(int interfaces, const char *device_name)
* cros_ec device */
if (!strcmp(CROS_EC_DEV_NAME, device_name)) {
/* Fallback to direct LPC on x86 */
- if ((interfaces & COMM_LPC) && !comm_init_lpc())
+ if ((interfaces & COMM_LPC) &&
+ comm_init_lpc && !comm_init_lpc())
return 0;
/* Fallback to direct i2c on ARM */
- if ((interfaces & COMM_I2C) && !comm_init_i2c())
+ if ((interfaces & COMM_I2C) &&
+ comm_init_i2c && !comm_init_i2c())
return 0;
}