Skip to content

Commit 588ab2d

Browse files
HoratiuVulturdavem330
authored andcommitted
net: sparx5: Fix reading of the MAC address
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: b74ef9f ("net: sparx5: Do not use mac_addr uninitialized in mchp_sparx5_probe()") Signed-off-by: Horatiu Vultur <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 06bf629 commit 588ab2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/microchip/sparx5/sparx5_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
834834
if (err)
835835
goto cleanup_config;
836836

837-
if (!of_get_mac_address(np, sparx5->base_mac)) {
837+
if (of_get_mac_address(np, sparx5->base_mac)) {
838838
dev_info(sparx5->dev, "MAC addr was not set, use random MAC\n");
839839
eth_random_addr(sparx5->base_mac);
840840
sparx5->base_mac[5] = 0;

0 commit comments

Comments
 (0)