]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
arm64: avoid -Woverride-init warning
authorArnd Bergmann <arnd@arndb.de>
Mon, 26 Oct 2020 19:37:46 +0000 (20:37 +0100)
committerWill Deacon <will@kernel.org>
Wed, 28 Oct 2020 13:38:36 +0000 (13:38 +0000)
commit332576e69a046b9b33f49bd0c3c071cc98215b60
tree8bf9015d5048f59f8c29e3109eef371607b3ccd7
parent1de111b51b829bcf01d2e57971f8fd07a665fa3f
arm64: avoid -Woverride-init warning

The icache_policy_str[] definition causes a warning when extra
warning flags are enabled:

arch/arm64/kernel/cpuinfo.c:38:26: warning: initialized field overwritten [-Woverride-init]
   38 |  [ICACHE_POLICY_VIPT]  = "VIPT",
      |                          ^~~~~~
arch/arm64/kernel/cpuinfo.c:38:26: note: (near initialization for 'icache_policy_str[2]')
arch/arm64/kernel/cpuinfo.c:39:26: warning: initialized field overwritten [-Woverride-init]
   39 |  [ICACHE_POLICY_PIPT]  = "PIPT",
      |                          ^~~~~~
arch/arm64/kernel/cpuinfo.c:39:26: note: (near initialization for 'icache_policy_str[3]')
arch/arm64/kernel/cpuinfo.c:40:27: warning: initialized field overwritten [-Woverride-init]
   40 |  [ICACHE_POLICY_VPIPT]  = "VPIPT",
      |                           ^~~~~~~
arch/arm64/kernel/cpuinfo.c:40:27: note: (near initialization for 'icache_policy_str[0]')

There is no real need for the default initializer here, as printing a
NULL string is harmless. Rewrite the logic to have an explicit
reserved value for the only one that uses the default value.

This partially reverts the commit that removed ICACHE_POLICY_AIVIVT.

Fixes: 155433cb365e ("arm64: cache: Remove support for ASID-tagged VIVT I-caches")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20201026193807.3816388-1-arnd@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/cache.h
arch/arm64/kernel/cpuinfo.c