diff options
Diffstat (limited to 'common/charger.c')
-rw-r--r-- | common/charger.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/charger.c b/common/charger.c index d2707473c8..0668bfb69f 100644 --- a/common/charger.c +++ b/common/charger.c @@ -515,7 +515,11 @@ enum ec_error_list charger_get_vbus_voltage(int port, int *voltage) enum ec_error_list charger_set_input_current_limit(int chgnum, int input_current) { - if ((chgnum < 0) || (chgnum >= board_get_charger_chip_count())) { + /* Note: may be called with CHARGE_PORT_NONE regularly */ + if (chgnum < 0) + return EC_ERROR_INVAL; + + if (chgnum >= board_get_charger_chip_count()) { CPRINTS("%s(%d) Invalid charger!", __func__, chgnum); return EC_ERROR_INVAL; } |