summaryrefslogtreecommitdiff
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-11-20 22:14:15 +0300
committerDavid S. Miller <davem@davemloft.net>2016-11-21 05:16:13 +0300
commit46712644d6e72d8a66f20f51e260e1c3d1eddfeb (patch)
tree8699565f47740f5d6edad020ec214ee734265076 /drivers/net/dsa
parenta3db3d3a52f0f159e0aa996792987acd8c14d2ad (diff)
downloadlinux-46712644d6e72d8a66f20f51e260e1c3d1eddfeb.tar.xz
net: dsa: mv88e6xxx: Fix unconditional irq freeing
Trying to remove an IRQ domain that was not created results in an Opps. Add the necessary checks that the irqs were created before freeing them. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 6aa81d2d8f63..b843052d32bd 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3897,10 +3897,11 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
out_mdio:
mv88e6xxx_mdio_unregister(chip);
out_g2_irq:
- if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT))
+ if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT) && chip->irq > 0)
mv88e6xxx_g2_irq_free(chip);
out_g1_irq:
- mv88e6xxx_g1_irq_free(chip);
+ if (chip->irq > 0)
+ mv88e6xxx_g1_irq_free(chip);
out:
return err;
}
@@ -3914,9 +3915,11 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
mv88e6xxx_unregister_switch(chip);
mv88e6xxx_mdio_unregister(chip);
- if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT))
- mv88e6xxx_g2_irq_free(chip);
- mv88e6xxx_g1_irq_free(chip);
+ if (chip->irq > 0) {
+ if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT))
+ mv88e6xxx_g2_irq_free(chip);
+ mv88e6xxx_g1_irq_free(chip);
+ }
}
static const struct of_device_id mv88e6xxx_of_match[] = {