diff options
author | Arnd Bergmann <arnd@arndb.de> | 2023-02-06 20:40:57 +0100 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2023-02-15 15:44:43 +0100 |
commit | 0c2baf6509af1d11310ae4c1c839481a6e9a4bc4 (patch) | |
tree | d323abbe1b9439f7800efa5d547d37bd9e38ade0 /kernel | |
parent | 55bf243c514553e907efcf2bda92ba090eca8c64 (diff) | |
download | lwn-0c2baf6509af1d11310ae4c1c839481a6e9a4bc4.tar.gz lwn-0c2baf6509af1d11310ae4c1c839481a6e9a4bc4.zip |
printf: fix errname.c list
On most architectures, gcc -Wextra warns about the list of error
numbers containing both EDEADLK and EDEADLOCK:
lib/errname.c:15:67: warning: initialized field overwritten [-Woverride-init]
15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
| ^~~
lib/errname.c:172:2: note: in expansion of macro 'E'
172 | E(EDEADLK), /* EDEADLOCK */
| ^
On parisc, a similar error happens with -ECANCELLED, which is an
alias for ECANCELED.
Make the EDEADLK printing conditional on the number being distinct
from EDEADLOCK, and remove the -ECANCELLED bit completely as it
can never be hit.
To ensure these are correct, add static_assert lines that verify
all the remaining aliases are in fact identical to the canonical
name.
Fixes: 57f5677e535b ("printf: add support for printing symbolic error names")
Cc: Petr Mladek <pmladek@suse.com>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/all/20210514213456.745039-1-arnd@kernel.org/
Link: https://lore.kernel.org/all/20210927123409.1109737-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20230206194126.380350-1-arnd@kernel.org
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions