• Arnd Bergmann's avatar
    octeontx2: fix -Wnonnull warning · b7fbc886
    Arnd Bergmann authored
    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: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarSunil Goutham <sgoutham@marvell.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b7fbc886
cgx.c 34.9 KB