1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/ethernet/microchip/sparx5
Nathan Chancellor b74ef9f9cb net: sparx5: Do not use mac_addr uninitialized in mchp_sparx5_probe()
Clang warns:

drivers/net/ethernet/microchip/sparx5/sparx5_main.c:760:29: warning:
variable 'mac_addr' is uninitialized when used here [-Wuninitialized]
        if (of_get_mac_address(np, mac_addr)) {
                                   ^~~~~~~~
drivers/net/ethernet/microchip/sparx5/sparx5_main.c:669:14: note:
initialize the variable 'mac_addr' to silence this warning
        u8 *mac_addr;
                    ^
                     = NULL
1 warning generated.

mac_addr is only used to store the value retrieved from
of_get_mac_address(), which is then copied into the base_mac member of
the sparx5 struct using ether_addr_copy(). It is easier to just use the
base_mac address directly, which avoids the warning and the extra copy.

Fixes: 3cfa11bac9 ("net: sparx5: add the basic sparx5 driver")
Link: https://github.com/ClangBuiltLinux/linux/issues/1413
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-28 15:50:21 -07:00
..
Kconfig net: sparx5: add the basic sparx5 driver 2021-06-24 11:28:12 -07:00
Makefile net: sparx5: add ethtool configuration and statistics support 2021-06-24 11:28:13 -07:00
sparx5_calendar.c net: sparx5: add calendar bandwidth allocation support 2021-06-24 11:28:13 -07:00
sparx5_ethtool.c net: sparx5: add ethtool configuration and statistics support 2021-06-24 11:28:13 -07:00
sparx5_mactable.c net: sparx5: add switching support 2021-06-24 11:28:13 -07:00
sparx5_main.c net: sparx5: Do not use mac_addr uninitialized in mchp_sparx5_probe() 2021-06-28 15:50:21 -07:00
sparx5_main.h net: sparx5: add ethtool configuration and statistics support 2021-06-24 11:28:13 -07:00
sparx5_main_regs.h net: sparx5: add the basic sparx5 driver 2021-06-24 11:28:12 -07:00
sparx5_netdev.c net: sparx5: add ethtool configuration and statistics support 2021-06-24 11:28:13 -07:00
sparx5_packet.c net: sparx5: add switching support 2021-06-24 11:28:13 -07:00
sparx5_phylink.c net: sparx5: add port module support 2021-06-24 11:28:12 -07:00
sparx5_port.c net: sparx5: add port module support 2021-06-24 11:28:12 -07:00
sparx5_port.h net: sparx5: add port module support 2021-06-24 11:28:12 -07:00
sparx5_switchdev.c net: sparx5: fix error return code in sparx5_register_notifier_blocks() 2021-06-28 14:20:23 -07:00
sparx5_vlan.c net: sparx5: add vlan support 2021-06-24 11:28:13 -07:00