# \[PATCH\] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one

- From: Menon, Nishanth \<nm@ti.com\>
- Date: 2012-06-01 07:05:55 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2012/06/8608220
- Thread: https://ratatoskr.run/linux-arm-kernel/2012/05/8608163/t.md

```text
On Fri, Jun 1, 2012 at 2:03 AM, Igor Grinberg [ref] wrote:
>
> On 06/01/12 02:15, Kevin Hilman wrote:
>> Nishanth Menon [ref] writes:
>>
>>> Commit 9fa2df6b90786301b175e264f5fa9846aba81a65
>>> (ARM: OMAP2+: OPP: allow OPP enumeration to continue if device is not present)
>>> makes the logic:
>>> for (i = 0; i < opp_def_size; i++) {
>>> ? ? ?<snip>
>>> ? ? ?if (!oh || !oh->od) {
>>> ? ? ? ? ? ? ?<snip>
>>> ? ? ? ? ? ? ?continue;
>>> ? ? ?}
>>> <snip>
>>> opp_def++;
>>> }
>>>
>>> In short, the moment we hit a "Bad OPP", we end up looping the list
>>> comparing against the bad opp definition pointer for the rest of the
>>> iteration count. Instead, increment opp_def in the for loop itself
>>> and allow continue to be used in code without much thought so that
>>> we check the next set of OPP definition pointers :)
>>>
>>> Cc: Kevin Hilman <redacted>
>>> Cc: Steve Sakoman <redacted>
>>> Cc: Tony Lindgren <tony@atomide.com>
>>> Cc: linux-omap at vger.kernel.org
>>> Cc: linux-arm-kernel at lists.infradead.org
>>>
>>> Signed-off-by: Nishanth Menon <nm@ti.com>
>>
>> Good catch.
>>
>> Queuing for my next set of PM fixes for v3.5-rc (branch: for_3.5/fixes/pm-2)
>
> I think this should also apply for stable, right?
> If it should, can you please add a
> Cc: stable at vger.kernel.org

I would like to think so, but punting over to Kevin on that decision.

Regards,
Nishanth Menon
```
