Message ID | 20220116211529.25604-5-tobias@waldekranz.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net/fsl: xgmac_mdio: Add workaround for erratum A-009885 | expand |
On Sun, Jan 16, 2022 at 10:15:29PM +0100, Tobias Waldekranz wrote: > As reported by sparse: In the remove path, the driver would attempt to > unmap its own priv pointer - instead of the io memory that it mapped > in probe. Hi Tobias The change itself is O.K. Reviewed-by: Andrew Lunn <andrew@lunn.ch> But you could also change to devm_ so the core will handle the unmap, it is very unlikely to unmap the wrong thing. Andrew
On Sun, Jan 16, 2022 at 22:54, Andrew Lunn <andrew@lunn.ch> wrote: > On Sun, Jan 16, 2022 at 10:15:29PM +0100, Tobias Waldekranz wrote: >> As reported by sparse: In the remove path, the driver would attempt to >> unmap its own priv pointer - instead of the io memory that it mapped >> in probe. > > Hi Tobias > > The change itself is O.K. > > Reviewed-by: Andrew Lunn <andrew@lunn.ch> > > But you could also change to devm_ so the core will handle the unmap, > it is very unlikely to unmap the wrong thing. Good idea. I have some more changes I want to include in this driver, but they are more net-next material. Will try to work in this change as well.
diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bf566ac3195b..266e562bd67a 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -331,9 +331,10 @@ static int xgmac_mdio_probe(struct platform_device *pdev) static int xgmac_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus = platform_get_drvdata(pdev); + struct mdio_fsl_priv *priv = bus->priv; mdiobus_unregister(bus); - iounmap(bus->priv); + iounmap(priv->mdio_base); mdiobus_free(bus); return 0;
As reported by sparse: In the remove path, the driver would attempt to unmap its own priv pointer - instead of the io memory that it mapped in probe. Fixes: 9f35a7342cff ("net/fsl: introduce Freescale 10G MDIO driver") Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> --- drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)