Commit 46712644 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

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: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3db3d3a
...@@ -3897,9 +3897,10 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) ...@@ -3897,9 +3897,10 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
out_mdio: out_mdio:
mv88e6xxx_mdio_unregister(chip); mv88e6xxx_mdio_unregister(chip);
out_g2_irq: 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); mv88e6xxx_g2_irq_free(chip);
out_g1_irq: out_g1_irq:
if (chip->irq > 0)
mv88e6xxx_g1_irq_free(chip); mv88e6xxx_g1_irq_free(chip);
out: out:
return err; return err;
...@@ -3914,9 +3915,11 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev) ...@@ -3914,9 +3915,11 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
mv88e6xxx_unregister_switch(chip); mv88e6xxx_unregister_switch(chip);
mv88e6xxx_mdio_unregister(chip); mv88e6xxx_mdio_unregister(chip);
if (chip->irq > 0) {
if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT)) if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT))
mv88e6xxx_g2_irq_free(chip); mv88e6xxx_g2_irq_free(chip);
mv88e6xxx_g1_irq_free(chip); mv88e6xxx_g1_irq_free(chip);
}
} }
static const struct of_device_id mv88e6xxx_of_match[] = { static const struct of_device_id mv88e6xxx_of_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment