sunxi: psci: avoid error address-of-packed-member
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 10 Nov 2019 03:10:27 +0000 (04:10 +0100)
committerJagan Teki <jagan@amarulasolutions.com>
Wed, 18 Dec 2019 14:43:34 +0000 (20:13 +0530)
commit9bd34a69a453d409792e08c00953ce8862145e65
tree41e7ca0029f1728f8960f9b392a5569f75c58513
parent643366bcd5e32878a951e39b8b553b794695b026
sunxi: psci: avoid error address-of-packed-member

Compiling with GCC 9.2.1 leads to build errors:

arch/arm/cpu/armv7/sunxi/psci.c: In function ‘sunxi_cpu_set_power’:
arch/arm/cpu/armv7/sunxi/psci.c:144:21: error: taking address of packed
member of ‘struct sunxi_cpucfg_reg’ may result in an unaligned pointer
value [-Werror=address-of-packed-member]
  144 |  sunxi_power_switch(&cpucfg->cpu1_pwr_clamp, &cpucfg->cpu1_pwroff,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm/cpu/armv7/sunxi/psci.c:144:46: error: taking address of packed
member of ‘struct sunxi_cpucfg_reg’ may result in an unaligned pointer
value [-Werror=address-of-packed-member]
  144 |  sunxi_power_switch(&cpucfg->cpu1_pwr_clamp, &cpucfg->cpu1_pwroff,
      |                                              ^~~~~~~~~~~~~~~~~~~~

Use memcpy() and void* pointers to resolve the problem caused by packing
the struct sunxi_cpucfg_reg.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
arch/arm/cpu/armv7/sunxi/psci.c