Skip to content

Commit

Permalink
dnet: fixup error handling in initialization
Browse files Browse the repository at this point in the history
There were two problems here.  We returned success if dnet_mii_init()
failed and there was a release_mem_region() missing.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Jul 31, 2010
1 parent c5cb002 commit de140b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/dnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ static int __devinit dnet_probe(struct platform_device *pdev)
dev = alloc_etherdev(sizeof(*bp));
if (!dev) {
dev_err(&pdev->dev, "etherdev alloc failed, aborting.\n");
goto err_out;
goto err_out_release_mem;
}

/* TODO: Actually, we have some interesting features... */
Expand Down Expand Up @@ -911,7 +911,8 @@ static int __devinit dnet_probe(struct platform_device *pdev)
if (err)
dev_warn(&pdev->dev, "Cannot register PHY board fixup.\n");

if (dnet_mii_init(bp) != 0)
err = dnet_mii_init(bp);
if (err)
goto err_out_unregister_netdev;

dev_info(&pdev->dev, "Dave DNET at 0x%p (0x%08x) irq %d %pM\n",
Expand All @@ -936,6 +937,8 @@ static int __devinit dnet_probe(struct platform_device *pdev)
iounmap(bp->regs);
err_out_free_dev:
free_netdev(dev);
err_out_release_mem:
release_mem_region(mem_base, mem_size);
err_out:
return err;
}
Expand Down

0 comments on commit de140b0

Please sign in to comment.