diff mbox

[v1,net-next,1/7] dsa: mv88e6xxx: Initialise the mutex as soon as it is created

Message ID 1462915645-24674-2-git-send-email-andrew@lunn.ch
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Andrew Lunn May 10, 2016, 9:27 p.m. UTC
By initialising immediately it, we don't run the danger of using it
before it is initialised.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/dsa/mv88e6xxx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 1e5ca8e0f48e..b2d27bfd53c2 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -3118,8 +3118,6 @@  static int mv88e6xxx_setup(struct dsa_switch *ds)
 
 	ps->ds = ds;
 
-	mutex_init(&ps->smi_mutex);
-
 	INIT_WORK(&ps->bridge_work, mv88e6xxx_bridge_work);
 
 	if (mv88e6xxx_has(ps, MV88E6XXX_FLAG_EEPROM))
@@ -3566,6 +3564,7 @@  static const char *mv88e6xxx_probe(struct device *dsa_dev,
 	ps->bus = bus;
 	ps->sw_addr = sw_addr;
 	ps->info = info;
+	mutex_init(&ps->smi_mutex);
 
 	*priv = ps;