Re: [PATCH 3/4] arm64: avoid -Woverride-init warning

From: Arnd Bergmann
Date: Mon Oct 26 2020 - 15:31:04 EST


On Mon, Oct 26, 2020 at 6:01 PM Mark Rutland <mark.rutland@xxxxxxx> wrote:
> On Mon, Oct 26, 2020 at 05:03:30PM +0100, Arnd Bergmann wrote:

> > @@ -335,6 +335,7 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
> > set_bit(ICACHEF_VPIPT, &__icache_flags);
> > break;
> > default:
> > + case ICACHE_POLICY_RESERVED:
> > case ICACHE_POLICY_VIPT:
> > /* Assume aliasing */
> > set_bit(ICACHEF_ALIASING, &__icache_flags);
> >
> ... but it's a bit weird to have both the default and
> ICACHE_POLICY_RESERVED cases. If we get rid of the default case, does
> any compiler warn? I suspect the masking in CTR_L1IP() might be
> sufficient to let the compiler see we've handled all cases.

It's not an enum, so the compiler doesn't actually know what the
complete set is and doesn't warn without the default. I'll send a v2.

Arnd