The for-loop looks a bit hard to read when we extract two arguments per iteration. The 'do {} while (true)' makes it easier to read despite being infinite loop. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- drivers/gpio/gpio-aggregator.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c index de9ae622ca23..962ec9373d6f 100644 --- a/drivers/gpio/gpio-aggregator.c +++ b/drivers/gpio/gpio-aggregator.c @@ -109,14 +109,17 @@ static int aggr_parse(struct gpio_aggregator *aggr) if (!bitmap) return -ENOMEM; - for (name = get_arg(&args), offsets = get_arg(&args); name; - offsets = get_arg(&args)) { + do { + name = get_arg(&args); + if (!name) + break; if (IS_ERR(name)) { pr_err("Cannot get GPIO specifier: %pe\n", name); error = PTR_ERR(name); goto free_bitmap; } + offsets = get_arg(&args); if (!isrange(offsets)) { /* Named GPIO line */ error = aggr_add_gpio(aggr, name, U16_MAX, &n); @@ -139,9 +142,7 @@ static int aggr_parse(struct gpio_aggregator *aggr) if (error) goto free_bitmap; } - - name = get_arg(&args); - } + } while (true); if (!n) { pr_err("No GPIOs specified\n"); -- 2.27.0