aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell/mvmdio.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-04-10 16:28:09 +0100
committerDavid S. Miller <davem@davemloft.net>2017-04-13 10:59:11 -0400
commit7093a9702e00274fde609d634010a5833b45b229 (patch)
treed39c5d09418f3e4029c94b52c8c5939dd284f7ab /drivers/net/ethernet/marvell/mvmdio.c
parentnet: mvmdio: disable interrupts in driver failure path (diff)
downloadlinux-dev-7093a9702e00274fde609d634010a5833b45b229.tar.xz
linux-dev-7093a9702e00274fde609d634010a5833b45b229.zip
net: mvmdio: fix interrupt disable in remove path
The pre-existing write to disable interrupts on the remove path happens whether we have an interrupt or not. While this may seem to be a good idea, this driver is re-used in many different implementations, some where the binding only specifies four bytes of register space. This access causes us to access registers outside of the binding. Make it conditional on the interrupt being present, which is the same condition used when enabling the interrupt in the first place. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/mvmdio.c')
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 7aea0beca56e..6ea5caddca62 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -263,7 +263,8 @@ static int orion_mdio_remove(struct platform_device *pdev)
struct mii_bus *bus = platform_get_drvdata(pdev);
struct orion_mdio_dev *dev = bus->priv;
- writel(0, dev->regs + MVMDIO_ERR_INT_MASK);
+ if (dev->err_interrupt > 0)
+ writel(0, dev->regs + MVMDIO_ERR_INT_MASK);
mdiobus_unregister(bus);
if (!IS_ERR(dev->clk))
clk_disable_unprepare(dev->clk);