public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] of: check for IS_ERR()
@ 2010-02-26  9:49 Dan Carpenter
  2010-02-26  9:54 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2010-02-26  9:49 UTC (permalink / raw)
  To: Grant Likely
  Cc: David S. Miller, Jeremy Kerr, Andy Fleming,
	Jérôme Pouiller, devicetree-discuss, linux-kernel

get_phy_device() can return an ERR_PTR()

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I don't have a cross compile environment set up so I can't even compile 
test this.  :/  But err.h is included so it should be OK.

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 18ecae4..b474833 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -69,7 +69,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 		}
 
 		phy = get_phy_device(mdio, be32_to_cpup(addr));
-		if (!phy) {
+		if (!phy || IS_ERR(phy)) {
 			dev_err(&mdio->dev, "error probing PHY at address %i\n",
 				*addr);
 			continue;

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

end of thread, other threads:[~2010-03-29 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-26  9:49 [patch] of: check for IS_ERR() Dan Carpenter
2010-02-26  9:54 ` David Miller
2010-02-26 16:11   ` Grant Likely
2010-03-29 15:41   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox