Skip to contentSkip to conversation

fsl_pq_mdio: Fix mdiobus allocation handling

PATCH New Anton Vorontsov 1 participant 1 message May 14, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsl_pq_mdio: Fix mdiobus allocation handling

The driver could return success code even if mdiobus_alloc() failed. This patch fixes the issue.

---
 drivers/net/fsl_pq_mdio.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/fsl_pq_mdio.c +4 -2
index 3acac5f..ff028f5 100644
@@ -277,15 +277,17 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 	int tbiaddr = -1;
 	const u32 *addrp;
 	u64 addr = 0, size = 0;
-	int err = 0;
+	int err;
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
 	new_bus = mdiobus_alloc();
-	if (NULL == new_bus)
+	if (!new_bus) {
+		err = -ENOMEM;
 		goto err_free_priv;
+	}
 
 	new_bus->name = "Freescale PowerQUICC MII Bus",
 	new_bus->read = &fsl_pq_mdio_read,
Signature · 1 line
1.7.0.5