Skip to content

Commit

Permalink
Blackfin arch: cplb mananger: use a do...while loop rather than a for…
Browse files Browse the repository at this point in the history
… loop

use a do...while loop rather than a for loop to get slightly better
optimization and to avoid gcc "may be used uninitialized" warnings ...
we know that the [id]cplb_nr_bounds variables will never be 0, so this
is OK

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
  • Loading branch information
Mike Frysinger authored and Bryan Wu committed Feb 4, 2009
1 parent bf324cb commit d04dfc4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions arch/blackfin/kernel/cplb-nompu/cplbmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@ MGR_ATTR static int icplb_miss(int cpu)
nr_icplb_supv_miss[cpu]++;

base = 0;
for (idx = 0; idx < icplb_nr_bounds; idx++) {
idx = 0;
do {
eaddr = icplb_bounds[idx].eaddr;
if (addr < eaddr)
break;
base = eaddr;
}
} while (++idx < icplb_nr_bounds);

if (unlikely(idx == icplb_nr_bounds))
return CPLB_NO_ADDR_MATCH;

Expand Down Expand Up @@ -208,12 +210,14 @@ MGR_ATTR static int dcplb_miss(int cpu)
nr_dcplb_supv_miss[cpu]++;

base = 0;
for (idx = 0; idx < dcplb_nr_bounds; idx++) {
idx = 0;
do {
eaddr = dcplb_bounds[idx].eaddr;
if (addr < eaddr)
break;
base = eaddr;
}
} while (++idx < dcplb_nr_bounds);

if (unlikely(idx == dcplb_nr_bounds))
return CPLB_NO_ADDR_MATCH;

Expand Down

0 comments on commit d04dfc4

Please sign in to comment.