net:fec: Add fec_enet_deinit()
[ Upstream commit bf0497f53c8535f99b72041529d3f7708a6e2c0d ]
When fec_probe() fails or fec_drv_remove() needs to release the
fec queue and remove a NAPI context, therefore add a function
corresponding to fec_enet_init() and call fec_enet_deinit() which
does the opposite to release memory and remove a NAPI context.
Fixes: 59d0f74656
("net: fec: init multi queue date structure")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240524050528.4115581-1-xiaolei.wang@windriver.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
29467edc23
commit
ddd2912a94
@ -3443,6 +3443,14 @@ static int fec_enet_init(struct net_device *ndev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fec_enet_deinit(struct net_device *ndev)
|
||||||
|
{
|
||||||
|
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||||
|
|
||||||
|
netif_napi_del(&fep->napi);
|
||||||
|
fec_enet_free_queue(ndev);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
static int fec_reset_phy(struct platform_device *pdev)
|
static int fec_reset_phy(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
@ -3813,6 +3821,7 @@ fec_probe(struct platform_device *pdev)
|
|||||||
fec_enet_mii_remove(fep);
|
fec_enet_mii_remove(fep);
|
||||||
failed_mii_init:
|
failed_mii_init:
|
||||||
failed_irq:
|
failed_irq:
|
||||||
|
fec_enet_deinit(ndev);
|
||||||
failed_init:
|
failed_init:
|
||||||
fec_ptp_stop(pdev);
|
fec_ptp_stop(pdev);
|
||||||
failed_reset:
|
failed_reset:
|
||||||
@ -3874,6 +3883,7 @@ fec_drv_remove(struct platform_device *pdev)
|
|||||||
pm_runtime_put_noidle(&pdev->dev);
|
pm_runtime_put_noidle(&pdev->dev);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
|
||||||
|
fec_enet_deinit(ndev);
|
||||||
free_netdev(ndev);
|
free_netdev(ndev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user