Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49c4d850 authored by Wang Hai's avatar Wang Hai Committed by Greg Kroah-Hartman
Browse files

net: smc91x: Fix possible memory leak in smc_drv_probe()



[ Upstream commit bca9749b1aa23d964d3ab930938af66dbf887f15 ]

If try_toggle_control_gpio() failed in smc_drv_probe(), free_netdev(ndev)
should be called to free the ndev created earlier. Otherwise, a memleak
will occur.

Fixes: 7d2911c4 ("net: smc91x: Fix gpios for device tree based booting")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 059e2392
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2294,7 +2294,7 @@ static int smc_drv_probe(struct platform_device *pdev)
		ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio,
					      "power", 0, 0, 100);
		if (ret)
			return ret;
			goto out_free_netdev;

		/*
		 * Optional reset GPIO configured? Minimum 100 ns reset needed
@@ -2303,7 +2303,7 @@ static int smc_drv_probe(struct platform_device *pdev)
		ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio,
					      "reset", 0, 0, 100);
		if (ret)
			return ret;
			goto out_free_netdev;

		/*
		 * Need to wait for optional EEPROM to load, max 750 us according