blob: af611eaa109e2f8a311c719fb946eefd9be4b07f [file] [log] [blame]
From 83067ad0b46b268b888b2d2f76036ce36a7ff203 Mon Sep 17 00:00:00 2001
From: Christophe JAILLET <>
Date: Sat, 25 Jan 2020 22:18:47 +0100
Subject: [PATCH] mlxsw: minimal: Fix an error handling path in
commit 6dd4b4f3936e17fedea1308bc70e9716f68bf232 upstream.
An 'alloc_etherdev()' called is not ballanced by a corresponding
'free_netdev()' call in one error handling path.
Slighly reorder the error handling code to catch the missed case.
Fixes: c100e47caa8e ("mlxsw: minimal: Add ethtool support")
Signed-off-by: Christophe JAILLET <>
Reviewed-by: Ido Schimmel <>
Signed-off-by: David S. Miller <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index cf2114273b72..089de6548f9c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -186,8 +186,8 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module)
mlxsw_m->ports[local_port] = NULL;
- free_netdev(dev);
+ free_netdev(dev);
mlxsw_core_port_fini(mlxsw_m->core, local_port);
return err;