summaryrefslogtreecommitdiff
path: root/chip/lm4/i2c.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-08-01 08:59:55 -0700
committerChromeBot <chrome-bot@google.com>2013-08-01 10:14:50 -0700
commit06c2ff46e9248eb73ffe52a98b96990cb8861dad (patch)
tree282a090d2431626ce01e4940c4a4ca722d70166e /chip/lm4/i2c.c
parentd4810438110bed94116081c4e01fd42227502628 (diff)
downloadchrome-ec-06c2ff46e9248eb73ffe52a98b96990cb8861dad.tar.gz
Add build-time checks on board-specific array sizes.
We've been declaring a bunch of statically-sized arrays: extern struct foo_t foo[FOO_COUNT]; And then initializing them like so: struct foo_t foo[FOO_COUNT] = { /* blah */ }; That only catches cases where we initialize with too many entries. It doesn't catch cases where we haven't initialized enough. This change tests for both cases like so: extern struct foo_t foo[]; struct foo_t foo[] = { /* blah */ }; BUILD_ASSERT(ARRAY_SIZE(foo) == FOO_COUNT); The affected arrays are: adc_channels[ADC_CH_COUNT] gpio_list[GPIO_COUNT] temp_sensors[TEMP_SENSOR_COUNT] x86_signal_list[X86_SIGNAL_COUNT] i2c_ports[I2C_PORTS_USED] BUG=chrome-os-partner:18343 BRANCH=falco,peppy TEST=build all platforms All platforms should still build, all tests should still pass. Original-Change-Id: Ibb16dc3201f32df7cdc875648e89ba4ffb09f733 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63833 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit af777297370e971bd4ae64e0e947cb5a1774dbfe) Change-Id: If8df7c902687c9a004c43128282300a6d0b2230c Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64217
Diffstat (limited to 'chip/lm4/i2c.c')
-rw-r--r--chip/lm4/i2c.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 390e0eef8b..abf82f62f4 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -38,7 +38,6 @@
#define LM4_I2C_MCS_CLKTO (1 << 7)
static task_id_t task_waiting_on_port[I2C_PORT_COUNT];
-extern const struct i2c_port_t i2c_ports[I2C_PORTS_USED];
/**
* Wait for port to go idle