Skip to content

Commit

Permalink
can't shift by more than length - release
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe44 committed Dec 28, 2021
1 parent 0d411d7 commit 1ee0a23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/services/gpio_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void service_handler(void *arg) {
xSemaphoreGive(expander->mutex);
ESP_LOGD(TAG, "Handling GPIO %d reads 0x%04x and has 0x%04x pending", expander->first, expander->shadow, pending);

for (int gpio = 31, clz; pending; pending <<= (clz + 1)) {
for (int gpio = 31, clz = 0; pending && clz < 31; pending <<= (clz + 1)) {
clz = __builtin_clz(pending);
gpio -= clz;
if (expander->isr[gpio].timer) xTimerReset(expander->isr[gpio].timer, 1); // todo 0
Expand Down

0 comments on commit 1ee0a23

Please sign in to comment.