Skip to content

Commit 35ae7f9

Browse files
jkrzysztlinusw
authored andcommitted
gpiolib: Fix missing updates of bitmap index
In new code introduced by commit b17566a ("gpiolib: Implement fast processing path in get/set array"), bitmap index is not updated with next found zero bit position as it should while skipping over pins already processed via fast bitmap path, possibly resulting in an infinite loop. Fix it. Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 212d706 commit 35ae7f9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/gpio/gpiolib.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,8 +2880,8 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep,
28802880
__set_bit(hwgpio, mask);
28812881

28822882
if (array_info)
2883-
find_next_zero_bit(array_info->get_mask,
2884-
array_size, i);
2883+
i = find_next_zero_bit(array_info->get_mask,
2884+
array_size, i);
28852885
else
28862886
i++;
28872887
} while ((i < array_size) &&
@@ -2905,7 +2905,8 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep,
29052905
trace_gpio_value(desc_to_gpio(desc), 1, value);
29062906

29072907
if (array_info)
2908-
find_next_zero_bit(array_info->get_mask, i, j);
2908+
j = find_next_zero_bit(array_info->get_mask, i,
2909+
j);
29092910
else
29102911
j++;
29112912
}
@@ -3192,8 +3193,8 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep,
31923193
}
31933194

31943195
if (array_info)
3195-
find_next_zero_bit(array_info->set_mask,
3196-
array_size, i);
3196+
i = find_next_zero_bit(array_info->set_mask,
3197+
array_size, i);
31973198
else
31983199
i++;
31993200
} while ((i < array_size) &&

0 commit comments

Comments
 (0)