]> git.baikalelectronics.ru Git - kernel.git/commit
octeontx2: fix -Wnonnull warning
authorArnd Bergmann <arnd@arndb.de>
Tue, 23 Mar 2021 12:53:29 +0000 (13:53 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Mar 2021 22:14:15 +0000 (15:14 -0700)
commitdf35dbf9ca84fc2c7f397329b9bf87b864e4fd74
tree0f501bfdb670ef5a8db212748476a8b385922ffb
parent24402c6fdcb4d7131720c5b01c1499b2f6df0176
octeontx2: fix -Wnonnull warning

When compile testing this driver on a platform on which probe() is
known to fail at compile time, gcc warns about the cgx_lmactype_string[]
array being uninitialized:

In function 'strncpy',
    inlined from 'link_status_user_format' at /git/arm-soc/drivers/net/ethernet/marvell/octeontx2/af/cgx.c:838:2,
    inlined from 'cgx_link_change_handler' at /git/arm-soc/drivers/net/ethernet/marvell/octeontx2/af/cgx.c:853:2:
include/linux/fortify-string.h:27:30: error: argument 2 null where non-null expected [-Werror=nonnull]
   27 | #define __underlying_strncpy __builtin_strncpy

Address this by turning the runtime initialization into a fixed array,
which should also produce better code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/cgx.c