Re: [PATCH v1 1/1] HID: debug: Remove duplicates from 'keys'

From: Andy Shevchenko
Date: Tue Oct 08 2024 - 15:07:06 EST


On Thu, Sep 05, 2024 at 09:43:50PM +0300, 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.

Can this be applied or is there another approach?

--
With Best Regards,
Andy Shevchenko