net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module
authorTobias Waldekranz <tobias@waldekranz.com>
Tue, 18 Jan 2022 21:50:53 +0000 (22:50 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Jan 2022 16:14:18 +0000 (08:14 -0800)
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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/xgmac_mdio.c

index bf566ac..266e562 100644 (file)
@@ -331,9 +331,10 @@ err_ioremap:
 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;