Subject: Re: [PATCH] bfin_mac: fix memleak in mii_bus{probe|remove}

From: Denis Kirjanov <[email-masked]>
Date: Tue, 18 May 2010 15:34:46 +0400

On Tue, May 18, 2010 at 18:05 +0800, Sonic Zhang wrote:
> 2010/5/18 Denis Kirjanov <[email-masked] <[email-masked]>:
> > Fix memory leak with miibus->irq
> >
> > Signed-off-by: Denis Kirjanov <[email-masked]>
> > ---
> >
> > drivers/net/bfin_mac.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
> > index 39a54ba..7a17b8a 100644
> > --- a/drivers/net/bfin_mac.c
> > +++ b/drivers/net/bfin_mac.c
> > @@ -1627,6 +1627,7 @@ static int __devinit bfin_mii_bus_probe(struct platform_device *pdev)
> >
> >  out_err_mdiobus_register:
> >        mdiobus_free(miibus);
> > +       kfree(miibus->irq);
> 
> Should you move this kfree before mdiobus_free?
> 
> >  out_err_alloc:
> >        peripheral_free_list(pin_req);
> >
> > @@ -1638,6 +1639,7 @@ static int __devexit bfin_mii_bus_remove(struct platform_device *pdev)
> >        struct mii_bus *miibus = platform_get_drvdata(pdev);
> >        platform_set_drvdata(pdev, NULL);
> >        mdiobus_unregister(miibus);
> > +       kfree(miibus->irq);
> >        mdiobus_free(miibus);
> >        peripheral_free_list(pin_req);
> >        return 0;
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to [email-masked]
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
Oops, yeah, fixed.
Thanks.

[PATCH] bfin_mac: fix memleak in mii_bus_{probe|remove}
Fix memory leak with miibus->irq

Signed-off-by: Denis Kirjanov <[email-masked]>
---
drivers/net/bfin_mac.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 39a54ba..368f333 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -1626,6 +1626,7 @@ static int __devinit bfin_mii_bus_probe(struct platform_device *pdev)
 	return 0;
 
 out_err_mdiobus_register:
+	kfree(miibus->irq);
 	mdiobus_free(miibus);
 out_err_alloc:
 	peripheral_free_list(pin_req);
@@ -1638,6 +1639,7 @@ static int __devexit bfin_mii_bus_remove(struct platform_device *pdev)
 	struct mii_bus *miibus = platform_get_drvdata(pdev);
 	platform_set_drvdata(pdev, NULL);
 	mdiobus_unregister(miibus);
+	kfree(miibus->irq);
 	mdiobus_free(miibus);
 	peripheral_free_list(pin_req);
 	return 0;