net: hns: Fix memleak in hns_nic_dev_probe
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 24 Aug 2020 05:44:42 +0000 (13:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:15 +0000 (19:14 +0200)
commit0c14725cb0631f3a31c74664a1dba98b3bd27bc1
tree97541f458e9ddfeadaad2fa7c03cce7952649b79
parenta949770022f48cd4de554d5fc68fdc06c22874fc
net: hns: Fix memleak in hns_nic_dev_probe

[ Upstream commit 100e3345c6e719d2291e1efd5de311cc24bb9c0b ]

hns_nic_dev_probe allocates ndev, but not free it on
two error handling paths, which may lead to memleak.

Fixes: 63434888aaf1b ("net: hns: net: hns: enet adds support of acpi")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns/hns_enet.c