mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
npcx: espi: Fix errors with unsigned variable
Because sig_idx was declared as uint8_t, if espi_vw_get_signal_index() returned an error value of -1, it wouldn't get caught. This would cause the arrays to access the wrong locations later. BUG=b:64477774 TEST=Build Change-Id: Ibe21d51c00ae3511a66a6976e18495c3f7683a78 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://chromium-review.googlesource.com/606453 Commit-Ready: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
@@ -273,7 +273,8 @@ void espi_vw_power_signal_interrupt(enum espi_vw_signal signal)
|
||||
*/
|
||||
int espi_vw_set_wire(enum espi_vw_signal signal, uint8_t level)
|
||||
{
|
||||
uint8_t offset, sig_idx, value;
|
||||
uint8_t offset, value;
|
||||
int sig_idx;
|
||||
|
||||
/* Get index of vw signal list by signale name */
|
||||
sig_idx = espi_vw_get_signal_index(signal);
|
||||
@@ -314,7 +315,8 @@ int espi_vw_set_wire(enum espi_vw_signal signal, uint8_t level)
|
||||
*/
|
||||
int espi_vw_get_wire(enum espi_vw_signal signal)
|
||||
{
|
||||
uint8_t offset, sig_idx, value;
|
||||
uint8_t offset, value;
|
||||
int sig_idx;
|
||||
|
||||
/* Get index of vw signal list by signale name */
|
||||
sig_idx = espi_vw_get_signal_index(signal);
|
||||
|
||||
Reference in New Issue
Block a user