net: dsa: mv88e6xxx: Hold the mutex while freeing g1 interrupts
authorAndrew Lunn <andrew@lunn.ch>
Sun, 20 Nov 2016 19:14:19 +0000 (20:14 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Nov 2016 02:16:13 +0000 (21:16 -0500)
Freeing interrupts requires switch register access to mask the
interrupts. Hence we must hold the register mutex.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c

index 614b2f68d401f82842d6ddce302ae34347a9359e..e30d0eaf2b5f1f6b8434af30009ca7ec4fe0e271 100644 (file)
@@ -3916,8 +3916,11 @@ out_g2_irq:
        if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT) && chip->irq > 0)
                mv88e6xxx_g2_irq_free(chip);
 out_g1_irq:
-       if (chip->irq > 0)
+       if (chip->irq > 0) {
+               mutex_lock(&chip->reg_lock);
                mv88e6xxx_g1_irq_free(chip);
+               mutex_unlock(&chip->reg_lock);
+       }
 out:
        return err;
 }