net: fman: Unregister ethernet device on removal
authorSean Anderson <sean.anderson@seco.com>
Thu, 3 Nov 2022 18:28:30 +0000 (14:28 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:35:35 +0000 (17:35 +0100)
commit202373a8f2907e0eeb27713961033aaabe2323f0
tree99041e8c2f86a8c7d72b9db1991d9bdb9eb02fae
parent5a067a8edf726f299e44b37eb7c39055a9a55b07
net: fman: Unregister ethernet device on removal

[ Upstream commit b7cbc6740bd6ad5d43345a2504f7e4beff0d709f ]

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: 3933961682a3 ("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>
drivers/net/ethernet/freescale/fman/mac.c