On Wed, Mar 10, 2010 at 8:16 AM, David Brownell <davi...@pacbell.net> wrote:
>> @@ -108,7 +108,7 @@ scan:
>>       }
>>
>>       /* Single sector, already protected?  Nothing to do! */
>> -     if (first == last)
>> +     if (first > last)
>
> ... not.  the loop previously maintained the "first <= last" invariant,
> and should still have done so.  "first > last" is clearly an error case.
Dave,
if only one sector is required to protect (first == last), and it is
already protected, the loop will "++first".
When the loop exits with "first > last" it means no sector need to
change protection.

Anyway, this code is really ugly.
I'm planning to rewrite the whole loop. I'll send patch in few hours.

Best Regards
Antonio Borneo
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to