[U-Boot-Users] Bug in StrataFlash drivers
Detlev Zundel
dzu at denx.de
Mon Nov 21 21:40:42 CET 2005
Hi,
> Hello,
>
>> I can see it hit here too:
>> case FLASH_CFI_32BIT:
>> cnt = len >> 2;
>> break;
>> default:
>> it is a div 4operation.. so last 3 bytes may go missin!!
>> Mebbe I am wrong abt it.. but then.. so it seems..
I guess code like this should read like
cnt = len + (2^n-1) >> n;
For the two cases in question (n=1)
cnt = len + 1 >> 1;
and (n=2)
cnt = len + 3 >> 2;
This avoids the branch.
Cheers
Detlev
--
Modern methods of production have given us the possibility of ease and
security for all; we have chosen, instead, to have overwork for some
and starvation for others.
-- Bertrand Russell
More information about the U-Boot
mailing list