From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v1 1/1] pinctrl: Move for_each_maps() to namespace and hide iterator inside
Date: Wed, 9 Nov 2022 18:08:33 +0200 [thread overview]
Message-ID: <Y2vQgdzBl+MvoqQM@smile.fi.intel.com> (raw)
In-Reply-To: <20221109155724.42354-1-andriy.shevchenko@linux.intel.com>
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
next prev parent reply other threads:[~2022-11-09 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 15:57 [PATCH v1 1/1] pinctrl: Move for_each_maps() to namespace and hide iterator inside Andy Shevchenko
2022-11-09 16:08 ` Andy Shevchenko [this message]
2022-11-10 9:55 ` Linus Walleij
2022-11-11 12:01 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2vQgdzBl+MvoqQM@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox