mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-01-25 11:25:17 +00:00
board/flagadm/flash.c: fix compile warning
Fix warning: flash.c:531: warning: dereferencing type-punned pointer will break strict-aliasing rules Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Kri Davsson <kd@flaga.is>
This commit is contained in:
parent
ef6061e49b
commit
d4a1561a84
1 changed files with 9 additions and 3 deletions
|
@ -528,11 +528,17 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
|
|||
ulong start;
|
||||
char csr;
|
||||
int flag;
|
||||
ushort * d = (ushort*)&da;
|
||||
int i;
|
||||
union {
|
||||
u32 data32;
|
||||
u16 data16[2];
|
||||
} data;
|
||||
|
||||
data.data32 = da;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if (((*addr & d[0]) != d[0]) || ((*(addr+1) & d[1]) != d[1])) {
|
||||
if (((*addr & data.data16[0]) != data.data16[0]) ||
|
||||
((*(addr+1) & data.data16[1]) != data.data16[1])) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
|
@ -544,7 +550,7 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
|
|||
*addr = 0x0010;
|
||||
|
||||
/* Write Data */
|
||||
*addr = d[i];
|
||||
*addr = data.data16[i];
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
|
|
Loading…
Reference in a new issue