Skip to content
Snippets Groups Projects
Commit 3b6a9267 authored by Wolfgang Denk's avatar Wolfgang Denk
Browse files

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: default avatarWolfgang Denk <wd@denx.de>
Cc: Kri Davsson <kd@flaga.is>
parent 084f3dda
No related branches found
No related tags found
No related merge requests found
...@@ -528,11 +528,17 @@ int write_word (flash_info_t *info, ulong dest, ulong da) ...@@ -528,11 +528,17 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
ulong start; ulong start;
char csr; char csr;
int flag; int flag;
ushort * d = (ushort*)&da;
int i; int i;
union {
u32 data32;
u16 data16[2];
} data;
data.data32 = da;
/* Check if Flash is (sufficiently) erased */ /* 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); return (2);
} }
/* Disable interrupts which might cause a timeout here */ /* Disable interrupts which might cause a timeout here */
...@@ -544,7 +550,7 @@ int write_word (flash_info_t *info, ulong dest, ulong da) ...@@ -544,7 +550,7 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
*addr = 0x0010; *addr = 0x0010;
/* Write Data */ /* Write Data */
*addr = d[i]; *addr = data.data16[i];
/* re-enable interrupts if necessary */ /* re-enable interrupts if necessary */
if (flag) if (flag)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment