Skip to content

Commit

Permalink
fsl_pq_mdio: Fix mdiobus allocation handling
Browse files Browse the repository at this point in the history
The driver could return success code even if mdiobus_alloc() failed.
This patch fixes the issue.

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Anton Vorontsov authored and David S. Miller committed May 18, 2010
1 parent a2f7922 commit 08d18f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/fsl_pq_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 08d18f3

Please sign in to comment.