netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@pengutronix.de>
To: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: netdev@vger.kernel.org, kernel@pengutronix.de, andrew@lunn.ch
Subject: Re: [PATCH 2/2] net: macb: add of_node_put to error paths
Date: Tue, 7 Nov 2017 11:00:46 +0100	[thread overview]
Message-ID: <20171107100046.7evwlc57wmsfbfmo@pengutronix.de> (raw)
In-Reply-To: <c4d08526-8760-d60a-8126-7ad1e094a9f9@microchip.com>

[-- Attachment #1: Type: text/plain, Size: 2187 bytes --]

On Tue, Nov 07, 2017 at 10:27:20AM +0100, Nicolas Ferre wrote:
> On 06/11/2017 at 12:10, Michael Grzeschik wrote:
> > We add the call of_node_put(bp->phy_node) to all associated error
> > paths for memory clean up.
> > 
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> >  drivers/net/ethernet/cadence/macb_main.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> > index 2c2acd011329a..2698a1fde39c7 100644
> > --- a/drivers/net/ethernet/cadence/macb_main.c
> > +++ b/drivers/net/ethernet/cadence/macb_main.c
> > @@ -611,6 +611,7 @@ static int macb_mii_init(struct macb *bp)
> >  err_out_unregister_bus:
> >  	mdiobus_unregister(bp->mii_bus);
> >  err_out_free_mdiobus:
> > +	of_node_put(bp->phy_node);
> 
> okay
> 
> >  	if ((np) && (of_phy_is_fixed_link(np)))
> >  		of_phy_deregister_fixed_link(np);
> >  	mdiobus_free(bp->mii_bus);
> > @@ -3554,6 +3555,7 @@ static int macb_probe(struct platform_device *pdev)
> >  err_out_unregister_mdio:
> >  	phy_disconnect(dev->phydev);
> >  	mdiobus_unregister(bp->mii_bus);
> > +	of_node_put(bp->phy_node);
> 
> yes
> 
> >  	if ((np) && (of_phy_is_fixed_link(np)))
> >  		of_phy_deregister_fixed_link(np);
> >  	mdiobus_free(bp->mii_bus);
> > @@ -3587,6 +3589,7 @@ static int macb_remove(struct platform_device *pdev)
> >  		if (dev->phydev)
> >  			phy_disconnect(dev->phydev);
> >  		mdiobus_unregister(bp->mii_bus);
> > +		of_node_put(bp->phy_node);
> 
> Isn't this call already done some lines below, just before
> "free_netdev(dev);"?

You are absolutely right. Will send v2.

> >  		if ((np) && (of_phy_is_fixed_link(np)))
> >  			of_phy_deregister_fixed_link(np);
> >  		dev->phydev = NULL;
> > 
> 
> Thanks for your patch.
Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-11-07 10:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 14:54 [PATCH v2] net: macb: add fixed-link node support Michael Grzeschik
2017-06-25 19:22 ` David Miller
2017-11-06  9:26 ` Nicolas Ferre
2017-11-06 11:10   ` [PATCH 1/2] net: macb: add of_phy_deregister_fixed_link to error paths Michael Grzeschik
2017-11-06 11:10     ` [PATCH 2/2] net: macb: add of_node_put " Michael Grzeschik
2017-11-07  9:27       ` Nicolas Ferre
2017-11-07  9:59         ` [PATCH v2] " Michael Grzeschik
2017-11-07 11:12           ` Nicolas Ferre
2017-11-08  6:29           ` David Miller
2017-11-07 10:00         ` Michael Grzeschik [this message]
2017-11-06 14:37     ` [PATCH 1/2] net: macb: add of_phy_deregister_fixed_link " Nicolas Ferre
2017-11-08  4:22     ` David Miller
2017-11-08  8:41       ` Michael Grzeschik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171107100046.7evwlc57wmsfbfmo@pengutronix.de \
    --to=mgr@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=kernel@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).