summaryrefslogtreecommitdiff
path: root/board/yorp
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2018-07-28 10:55:27 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-07-30 23:08:08 -0700
commit1513e1dc9b03f032b07ce09254d42fe6a1fbb296 (patch)
tree8d58d409d27f6e8fe45ca990d1fc2a54f35936a7 /board/yorp
parent99b25eca1e3481e2960a9a084503e5a9211dcc7b (diff)
downloadchrome-ec-1513e1dc9b03f032b07ce09254d42fe6a1fbb296.tar.gz
Octopus: Avoid potential panic in LED code
When the charge is in idle mode LED array is out of bound hence there is potential panic. Fill the LED array to defined number of LED states. BUG=b:111913899 BRANCH=none TEST=Manually tested on yorp "chgstate discharge on" doesn't panic anymore Change-Id: Ib9c52b68b0ec9440911f15b6c09e8505b2b20e95 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1153782 Commit-Ready: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/yorp')
-rw-r--r--board/yorp/led.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/board/yorp/led.c b/board/yorp/led.c
index 9040452f17..5e97887722 100644
--- a/board/yorp/led.c
+++ b/board/yorp/led.c
@@ -20,6 +20,8 @@ const int led_charge_lvl_2 = 100;
/* Yorp: Note there is only LED for charge / power */
const struct led_descriptor
led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
+ {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
[STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
[STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
[STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
@@ -28,7 +30,9 @@ const struct led_descriptor
[STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
[STATE_BATTERY_ERROR] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
{EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
+ [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
};
+BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };