Skip to content

Commit 8a3e4a5

Browse files
Demon000jic23
authored andcommitted
iio: addac: ad74413r: use ngpio size when iterating over mask
ngpio is the actual number of GPIOs handled by the GPIO chip, as opposed to the max number of GPIOs. Fixes: fea251b ("iio: addac: add AD74413R driver") Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220111074703.3677392-1-cosmin.tanislav@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent e7a3290 commit 8a3e4a5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iio/addac/ad74413r.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static void ad74413r_gpio_set_multiple(struct gpio_chip *chip,
288288
unsigned int offset = 0;
289289
int ret;
290290

291-
for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
291+
for_each_set_bit_from(offset, mask, chip->ngpio) {
292292
unsigned int real_offset = st->gpo_gpio_offsets[offset];
293293

294294
ret = ad74413r_set_gpo_config(st, real_offset,
@@ -334,7 +334,7 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
334334
if (ret)
335335
return ret;
336336

337-
for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
337+
for_each_set_bit_from(offset, mask, chip->ngpio) {
338338
unsigned int real_offset = st->comp_gpio_offsets[offset];
339339

340340
if (val & BIT(real_offset))

0 commit comments

Comments
 (0)