]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fru: common: Switch capture variable with the rest
authorMichal Simek <michal.simek@xilinx.com>
Fri, 6 Nov 2020 12:53:01 +0000 (13:53 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 20 Nov 2020 09:42:54 +0000 (10:42 +0100)
capture variable is bool which is just one byte and it is just causing
unaligned accesses. Better to have it as last entry in the structure.

It also simplify offset calculation for initial header copy.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/common/fru.h
board/xilinx/common/fru_ops.c

index a3e652025714a141488b53406d44b7beeff0459b..e85dde45314f55f33cc4eda625dd7c267c89c155 100644 (file)
@@ -53,9 +53,9 @@ struct fru_board_data {
 };
 
 struct fru_table {
-       bool captured;
        struct fru_common_hdr hdr;
        struct fru_board_data brd;
+       bool captured;
 };
 
 #define FRU_TYPELEN_CODE_MASK  0xC0
index fc3add7d93da2f79d25f686ff35f36abe64fb38e..affcb121aa9cf1f1597e069260edeeb29ff699dd 100644 (file)
@@ -217,7 +217,7 @@ int fru_capture(unsigned long addr)
 
        hdr = (struct fru_common_hdr *)addr;
 
-       memcpy((void *)&fru_data.hdr, (void *)hdr,
+       memcpy((void *)&fru_data, (void *)hdr,
               sizeof(struct fru_common_hdr));
 
        fru_data.captured = true;