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 a3e6520..e85dde4 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 fc3add7..affcb12 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;