summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2022-11-22 10:45:21 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-24 00:16:35 +0000
commit5dd8dc90c1e8cb099a42eaa87d71774980b1a6ad (patch)
treef5c5cda3c7ca75d791826d4f2800056fa8bbcdef /common
parent5b567a785489cd28c4ef585e1a4fb6ece46bf3f4 (diff)
downloadchrome-ec-5dd8dc90c1e8cb099a42eaa87d71774980b1a6ad.tar.gz
i2c_controller: Add guard for PEC transfers
One path in the code was missing a guard checking CONFIG_SMBUS_PEC before checking the I2C_USE_PEC. The gcc optimizer already removed this code when CONFIG_SMBUS_PEC=n, but the coverage tool thought this path was executable. BUG=none BRANCH=none TEST=twister TEST=zmake compare-builds herobrine Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9c5f95982ba7428fd190f98e16801886bc8aedeb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049220 Reviewed-by: Sam Hurst <shurst@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'common')
-rw-r--r--common/i2c_controller.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c
index b51f726369..e938dc0f8f 100644
--- a/common/i2c_controller.c
+++ b/common/i2c_controller.c
@@ -833,7 +833,7 @@ int i2c_write_block(const int port, const uint16_t addr_flags, int offset,
if (rv)
continue;
- if (I2C_USE_PEC(addr_flags)) {
+ if (IS_ENABLED(CONFIG_SMBUS_PEC) && I2C_USE_PEC(addr_flags)) {
rv = i2c_xfer_unlocked(port, addr_flags, data, len,
NULL, 0, 0);
if (rv)