LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [2.6 patch] net/phy/mdio_bus.c: fix a check-after-use
@ 2008-02-20  0:13 Adrian Bunk
  2008-02-20 16:52 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2008-02-20  0:13 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, linux-kernel

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

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
6beeb3ac577d74d72b2f91bd654eecb904c3c17e diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6e9f619..963630c 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -49,13 +49,13 @@ int mdiobus_register(struct mii_bus *bus)
 	int i;
 	int err = 0;
 
-	mutex_init(&bus->mdio_lock);
-
 	if (NULL == bus || NULL == bus->name ||
 			NULL == bus->read ||
 			NULL == bus->write)
 		return -EINVAL;
 
+	mutex_init(&bus->mdio_lock);
+
 	if (bus->reset)
 		bus->reset(bus);
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.6 patch] net/phy/mdio_bus.c: fix a check-after-use
  2008-02-20  0:13 [2.6 patch] net/phy/mdio_bus.c: fix a check-after-use Adrian Bunk
@ 2008-02-20 16:52 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2008-02-20 16:52 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: netdev, linux-kernel

Adrian Bunk wrote:
> This patch fixes a check-after-use spotted by the Coverity checker.
> 
> Signed-off-by: Adrian Bunk <bunk@kernel.org>
> 
> ---
> 6beeb3ac577d74d72b2f91bd654eecb904c3c17e diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 6e9f619..963630c 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -49,13 +49,13 @@ int mdiobus_register(struct mii_bus *bus)
>  	int i;
>  	int err = 0;
>  
> -	mutex_init(&bus->mdio_lock);
> -
>  	if (NULL == bus || NULL == bus->name ||
>  			NULL == bus->read ||
>  			NULL == bus->write)
>  		return -EINVAL;
>  
> +	mutex_init(&bus->mdio_lock);
> +

applied



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-20 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20  0:13 [2.6 patch] net/phy/mdio_bus.c: fix a check-after-use Adrian Bunk
2008-02-20 16:52 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).