[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2vQgdzBl+MvoqQM@smile.fi.intel.com>
Date: Wed, 9 Nov 2022 18:08:33 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v1 1/1] pinctrl: Move for_each_maps() to namespace and
hide iterator inside
On Wed, Nov 09, 2022 at 05:57:24PM +0200, Andy Shevchenko wrote:
> First of all, while for_each_maps() is private to pin control subsystem
> it's still better to have it put into a namespace.
>
> Besides that, users are not relying on iterator variable, so hide it
> inside for-loop.
...
> +#define for_each_pin_map(_maps_node_, _map_) \
> + list_for_each_entry(_maps_node_, &pinctrl_maps, node) \
> + for (unsigned int __i = 0; \
> + _map_ = &_maps_node_->maps[__i], __i < _maps_node_->num_maps; \
Hmm... I think this is actually not okay, if we have maps be NULL and
num_maps = 0, KABOOM is guaranteed.
I will experiment and update this.
Meanwhile, Linus, do you think this change is useful?
> + __i++)
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists