Browse Source

net/phy/mdio_bus.c: fix a check-after-use

This patch fixes a check-after-use spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Adrian Bunk 17 years ago
parent
commit
d1e7fe4d92
1 changed files with 2 additions and 2 deletions
  1. 2 2
      drivers/net/phy/mdio_bus.c

+ 2 - 2
drivers/net/phy/mdio_bus.c

@@ -49,13 +49,13 @@ int mdiobus_register(struct mii_bus *bus)
 	int i;
 	int i;
 	int err = 0;
 	int err = 0;
 
 
-	mutex_init(&bus->mdio_lock);
-
 	if (NULL == bus || NULL == bus->name ||
 	if (NULL == bus || NULL == bus->name ||
 			NULL == bus->read ||
 			NULL == bus->read ||
 			NULL == bus->write)
 			NULL == bus->write)
 		return -EINVAL;
 		return -EINVAL;
 
 
+	mutex_init(&bus->mdio_lock);
+
 	if (bus->reset)
 	if (bus->reset)
 		bus->reset(bus);
 		bus->reset(bus);