From: Qian Cai <cai@lca.pw>
To: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] arm64/cache: fix -Woverride-init compiler warnings
Date: Wed, 7 Aug 2019 07:50:43 -0400 [thread overview]
Message-ID: <D11F0810-A6D0-4835-B71A-9DDDC120423B@lca.pw> (raw)
In-Reply-To: <20190807105652.cyi3fou2rfsxhxrk@willie-the-truck>
> On Aug 7, 2019, at 6:56 AM, Will Deacon <will@kernel.org> wrote:
>
> On Tue, Aug 06, 2019 at 03:34:34PM -0400, Qian Cai wrote:
>> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
>> index 876055e37352..a0c495a3f4fd 100644
>> --- a/arch/arm64/kernel/cpuinfo.c
>> +++ b/arch/arm64/kernel/cpuinfo.c
>> @@ -34,10 +34,7 @@ DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
>> static struct cpuinfo_arm64 boot_cpu_data;
>>
>> static char *icache_policy_str[] = {
>> - [0 ... ICACHE_POLICY_PIPT] = "RESERVED/UNKNOWN",
>> - [ICACHE_POLICY_VIPT] = "VIPT",
>> - [ICACHE_POLICY_PIPT] = "PIPT",
>> - [ICACHE_POLICY_VPIPT] = "VPIPT",
>> + [0 ... ICACHE_POLICY_PIPT] = "RESERVED/UNKNOWN"
>> };
>>
>> unsigned long __icache_flags;
>> @@ -310,13 +307,16 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
>>
>> switch (l1ip) {
>> case ICACHE_POLICY_PIPT:
>> + icache_policy_str[ICACHE_POLICY_PIPT] = "PIPT";
>> break;
>> case ICACHE_POLICY_VPIPT:
>> + icache_policy_str[ICACHE_POLICY_VPIPT] = "VPIPT";
>> set_bit(ICACHEF_VPIPT, &__icache_flags);
>> break;
>> default:
>> /* Fallthrough */
>> case ICACHE_POLICY_VIPT:
>> + icache_policy_str[ICACHE_POLICY_VIPT] = "VIPT";
>> /* Assume aliasing */
>> set_bit(ICACHEF_ALIASING, &__icache_flags);
>
> I still think this is worse than the code in mainline. I don't think
> -Woverride-init should warn when overriding a field from a GCC range
> designated initialiser, since it makes them considerably less useful
> imo.
Unfortunately, compiler people are moving into a different direction as
Clang would warn those kind of usage too.
It actually prove that those warnings are useful to find real issues. See,
Fae5e033d65a (“mfd: rk808: Fix RK818_IRQ_DISCHG_ILIM initializer”)
32df34d875bb (“[media] rc: img-ir: jvc: Remove unused no-leader timings”)
Especially, to find redundant initializations in large structures. e.g.,
e6ea0b917875 (“[media] dvb_frontend: Don't declare values twice at a table”)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-07 11:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 19:34 [PATCH v2] arm64/cache: fix -Woverride-init compiler warnings Qian Cai
2019-08-07 10:53 ` Mark Rutland
2019-08-07 10:56 ` Will Deacon
2019-08-07 11:50 ` Qian Cai [this message]
2019-08-07 11:59 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D11F0810-A6D0-4835-B71A-9DDDC120423B@lca.pw \
--to=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).