net: sparx5: Fix reading of the MAC address
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Mon, 2 Jan 2023 12:12:15 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:59:14 +0000 (11:59 +0100)
commit774d259749d7883e1b962d42e1ff1a2e1a922c79
treeb28ea46f1bcbefd88d83abed4e60ac61b74aaa53
parent04dc4003e5df33fb38d3dd85568b763910c479d4
net: sparx5: Fix reading of the MAC address

[ Upstream commit 588ab2dc25f60efeb516b4abedb6c551949cc185 ]

There is an issue with the checking of the return value of
'of_get_mac_address', which returns 0 on success and negative value on
failure. The driver interpretated the result the opposite way. Therefore
if there was a MAC address defined in the DT, then the driver was
generating a random MAC address otherwise it would use address 0.
Fix this by checking correctly the return value of 'of_get_mac_address'

Fixes: b74ef9f9cb91 ("net: sparx5: Do not use mac_addr uninitialized in mchp_sparx5_probe()")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/microchip/sparx5/sparx5_main.c