Message ID | 1359473048-26551-2-git-send-email-florian@openwrt.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Dear Florian Fainelli, On Tue, 29 Jan 2013 16:24:04 +0100, Florian Fainelli wrote: > Fix the driver remove callback to unmap the base register address and > not leak this mapping after the driver has been removed. > > Signed-off-by: Florian Fainelli <florian@openwrt.org> What about using devm_request_and_ioremap() instead, in order to get automatic unmap on error and in the ->remove() path? But maybe it won't work because this memory range is claimed both by the MDIO driver and the Ethernet driver itself. In that case, you could use devm_ioremap(). Best regards, Thomas
On 01/29/2013 04:32 PM, Thomas Petazzoni wrote: > Dear Florian Fainelli, > > On Tue, 29 Jan 2013 16:24:04 +0100, Florian Fainelli wrote: >> Fix the driver remove callback to unmap the base register address and >> not leak this mapping after the driver has been removed. >> >> Signed-off-by: Florian Fainelli <florian@openwrt.org> > What about using devm_request_and_ioremap() instead, in order to get > automatic unmap on error and in the ->remove() path? Right now, you are using of_iomap() which eases the task of fetching the resource and getting an ioremap cookie, which I why I kept that. > > But maybe it won't work because this memory range is claimed both by > the MDIO driver and the Ethernet driver itself. In that case, you could > use devm_ioremap(). Then we would loose the facility of of_iomap(), but fair enough, it can be inserted as a patch in this serie. Thanks -- Florian
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index 74f1c15..be5c690 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -200,9 +200,12 @@ static int orion_mdio_probe(struct platform_device *pdev) static int orion_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus = platform_get_drvdata(pdev); + struct orion_mdio_dev *dev = bus->priv; + mdiobus_unregister(bus); kfree(bus->irq); mdiobus_free(bus); + iounmap(dev->smireg); return 0; }
Fix the driver remove callback to unmap the base register address and not leak this mapping after the driver has been removed. Signed-off-by: Florian Fainelli <florian@openwrt.org> --- drivers/net/ethernet/marvell/mvmdio.c | 3 +++ 1 file changed, 3 insertions(+)