Re: [PATCH] leds: pwm: Annotate leds[] with __counted_by()

Mert Seftali <[email protected]>
Newsgroups org.kernel.vger.linux-leds,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel
Message-ID <CAA3NooqNH4Pu2EaiwOJOmDV5oQ9HNw1aAu_naXS75LL=EnmRzQ@mail.gmail.com>
On Fri, 19 Jun 2026, Lee Jones wrote:
> Nit, why not keep the variable names the same rather than use the for
> iterator?  i's and j's are usually for throw-away variables, but this is
> counting something real.
>
> Or if you wanted to be even smarter, why not just pass the priv->leds[n]
> that you want to operate on and increment num_leds here instead?
> Less args == more better.

Sure, that's tidier, i'll do both. Passing the led_pwm_data element in
means led_pwm_add doesn't need priv or the index anymore, so it drops to
(dev, led_data, led, fwnode). And bumping num_leds in the loop means it
doubles as the index, so the throw-away i goes away too.

will prepare v2, thanks for the review!

Mert
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.