mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 10:01:25 +00:00
net: fman: Unregister ethernet device on removal
[ Upstream commitb7cbc6740b
] When the mac device gets removed, it leaves behind the ethernet device. This will result in a segfault next time the ethernet device accesses mac_dev. Remove the ethernet device when we get removed to prevent this. This is not completely reversible, since some resources aren't cleaned up properly, but that can be addressed later. Fixes:3933961682
("fsl/fman: Add FMan MAC driver") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Link: https://lore.kernel.org/r/20221103182831.2248833-1-sean.anderson@seco.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
328a8acbf0
commit
5549787c45
1 changed files with 9 additions and 0 deletions
|
@ -882,12 +882,21 @@ _return:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mac_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct mac_device *mac_dev = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
platform_device_unregister(mac_dev->priv->eth_dev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct platform_driver mac_driver = {
|
static struct platform_driver mac_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = KBUILD_MODNAME,
|
.name = KBUILD_MODNAME,
|
||||||
.of_match_table = mac_match,
|
.of_match_table = mac_match,
|
||||||
},
|
},
|
||||||
.probe = mac_probe,
|
.probe = mac_probe,
|
||||||
|
.remove = mac_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
builtin_platform_driver(mac_driver);
|
builtin_platform_driver(mac_driver);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue