Re: [PATCH v1 1/1] HID: debug: Remove duplicates from 'keys'
From: Jiri Kosina
Date: Tue Oct 15 2024 - 08:20:44 EST
On Thu, 5 Sep 2024, Andy Shevchenko wrote:
> Duplicates in 'keys prevents kernel builds with clang, `make W=1` and
> CONFIG_WERROR=y, for example:
>
> drivers/hid/hid-debug.c:3443:18: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
> 3443 | [KEY_HANGEUL] = "HanGeul", [KEY_HANGUP_PHONE] = "HangUpPhone",
> | ^~~~~~~~~
> drivers/hid/hid-debug.c:3217:18: note: previous initialization is here
> 3217 | [KEY_HANGUEL] = "Hangeul", [KEY_HANJA] = "Hanja",
> | ^~~~~~~~~
>
> Fix this by removing them.
>
> The logic of removal is that, remove...
> 1) if there is a constant that uses another defined constant, OR
> 2) the one that appears later in the list.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> drivers/hid/hid-debug.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
> index d5abfe652fb5..618ebaa3bfc0 100644
> --- a/drivers/hid/hid-debug.c
> +++ b/drivers/hid/hid-debug.c
> @@ -3214,7 +3214,7 @@ static const char *keys[KEY_MAX + 1] = {
> [KEY_VOLUMEUP] = "VolumeUp", [KEY_POWER] = "Power",
> [KEY_KPEQUAL] = "KPEqual", [KEY_KPPLUSMINUS] = "KPPlusMinus",
> [KEY_PAUSE] = "Pause", [KEY_KPCOMMA] = "KPComma",
> - [KEY_HANGUEL] = "Hangeul", [KEY_HANJA] = "Hanja",
The problem specifically with this one is really there to fix a typo
someone did at some point in the past. See b9ab58dd8e771d ("Input: fix
misspelling of Hangeul key").
So I think we should preserve it somehow.
The remaining ones seem indeed to be duplicates and I don't see a problem
removing them.
Thanks,
--
Jiri Kosina
SUSE Labs