netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: sparx5: Fix reading of the MAC address
@ 2023-01-02 12:12 Horatiu Vultur
  2023-01-02 13:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Horatiu Vultur @ 2023-01-02 12:12 UTC (permalink / raw)
  To: netdev, linux-arm-kernel, linux-kernel
  Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
	daniel.machon, UNGLinuxDriver, casper.casan, rmk+kernel,
	linqiheng, nathan, Horatiu Vultur

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>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
index d25f4f09faa06..3c5d4fe993737 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
@@ -834,7 +834,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
 	if (err)
 		goto cleanup_config;
 
-	if (!of_get_mac_address(np, sparx5->base_mac)) {
+	if (of_get_mac_address(np, sparx5->base_mac)) {
 		dev_info(sparx5->dev, "MAC addr was not set, use random MAC\n");
 		eth_random_addr(sparx5->base_mac);
 		sparx5->base_mac[5] = 0;
-- 
2.38.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: sparx5: Fix reading of the MAC address
  2023-01-02 12:12 [PATCH net] net: sparx5: Fix reading of the MAC address Horatiu Vultur
@ 2023-01-02 13:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-02 13:50 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: netdev, linux-arm-kernel, linux-kernel, davem, edumazet, kuba,
	pabeni, lars.povlsen, Steen.Hegelund, daniel.machon,
	UNGLinuxDriver, casper.casan, rmk+kernel, linqiheng, nathan

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 2 Jan 2023 13:12:15 +0100 you wrote:
> 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'
> 
> [...]

Here is the summary with links:
  - [net] net: sparx5: Fix reading of the MAC address
    https://git.kernel.org/netdev/net/c/588ab2dc25f6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-02 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-02 12:12 [PATCH net] net: sparx5: Fix reading of the MAC address Horatiu Vultur
2023-01-02 13:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).