From: Christophe JAILLET Date: Sat, 25 Jan 2020 21:18:47 +0000 (+0100) Subject: mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()' X-Git-Tag: v5.4.17~70 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=73226c74746d4906ba1d591f4bca8f6253de14d7;p=arm%2Flinux.git mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()' [ Upstream commit 6dd4b4f3936e17fedea1308bc70e9716f68bf232 ] 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: Greg Kroah-Hartman --- diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c index 471b0ca6d69a..55dfba990e6e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c @@ -204,8 +204,8 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module) err_register_netdev: mlxsw_m->ports[local_port] = NULL; - free_netdev(dev); err_dev_addr_get: + free_netdev(dev); err_alloc_etherdev: mlxsw_core_port_fini(mlxsw_m->core, local_port); return err;