瀏覽代碼

dsa: mv88e6xxx: Initialise the mutex as soon as it is created

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Andrew Lunn 9 年之前
父節點
當前提交
b681957ad4
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      drivers/net/dsa/mv88e6xxx.c

+ 1 - 2
drivers/net/dsa/mv88e6xxx.c

@@ -3132,8 +3132,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))
@@ -3580,6 +3578,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;