From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: <netdev@vger.kernel.org>, <kernel@pengutronix.de>, <andrew@lunn.ch>
Subject: Re: [PATCH v2 1/2] net: macb: add of_phy_deregister_fixed_link to error paths
Date: Wed, 8 Nov 2017 10:26:13 +0100 [thread overview]
Message-ID: <f74bb69d-a98f-f943-f829-75d4018c3fd8@microchip.com> (raw)
In-Reply-To: <20171108085635.2742-2-m.grzeschik@pengutronix.de>
On 08/11/2017 at 09:56, Michael Grzeschik wrote:
> We add the call of_phy_deregister_fixed_link to all associated
> error paths for memory clean up.
>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
> v2: removed extra parenthesis
>
> drivers/net/ethernet/cadence/macb_main.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 6df2cad61647a..b7846d6e9234e 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -611,6 +611,8 @@ static int macb_mii_init(struct macb *bp)
> err_out_unregister_bus:
> mdiobus_unregister(bp->mii_bus);
> err_out_free_mdiobus:
> + if (np && of_phy_is_fixed_link(np))
> + of_phy_deregister_fixed_link(np);
> mdiobus_free(bp->mii_bus);
> err_out:
> return err;
> @@ -3552,6 +3554,8 @@ static int macb_probe(struct platform_device *pdev)
> err_out_unregister_mdio:
> phy_disconnect(dev->phydev);
> mdiobus_unregister(bp->mii_bus);
> + if (np && of_phy_is_fixed_link(np))
> + of_phy_deregister_fixed_link(np);
> mdiobus_free(bp->mii_bus);
>
> /* Shutdown the PHY if there is a GPIO reset */
> @@ -3574,6 +3578,7 @@ static int macb_remove(struct platform_device *pdev)
> {
> struct net_device *dev;
> struct macb *bp;
> + struct device_node *np = pdev->dev.of_node;
>
> dev = platform_get_drvdata(pdev);
>
> @@ -3582,6 +3587,8 @@ static int macb_remove(struct platform_device *pdev)
> if (dev->phydev)
> phy_disconnect(dev->phydev);
> mdiobus_unregister(bp->mii_bus);
> + if (np && of_phy_is_fixed_link(np))
> + of_phy_deregister_fixed_link(np);
> dev->phydev = NULL;
> mdiobus_free(bp->mii_bus);
>
>
--
Nicolas Ferre
next prev parent reply other threads:[~2017-11-08 9:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 8:56 [PATCH v2 0/2] net: macb: add error handling on probe and Michael Grzeschik
2017-11-08 8:56 ` [PATCH v2 1/2] net: macb: add of_phy_deregister_fixed_link to error paths Michael Grzeschik
2017-11-08 9:26 ` Nicolas Ferre [this message]
2017-11-08 8:56 ` [PATCH v2 2/2] net: macb: add of_node_put " Michael Grzeschik
2017-11-08 9:26 ` Nicolas Ferre
2017-11-11 6:28 ` [PATCH v2 0/2] net: macb: add error handling on probe and David Miller
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=f74bb69d-a98f-f943-f829-75d4018c3fd8@microchip.com \
--to=nicolas.ferre@microchip.com \
--cc=andrew@lunn.ch \
--cc=kernel@pengutronix.de \
--cc=m.grzeschik@pengutronix.de \
--cc=netdev@vger.kernel.org \
/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).