From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Li Yang <leoli@freescale.com>
Cc: netdev@vger.kernel.org, Florian Fainelli <f.fainelli@gmail.com>,
linuxppc-dev@lists.ozlabs.org, kernel@pengutronix.de
Subject: Re: [PATCH 1/3] net: ucc_geth: drop acquired references in probe error path and remove
Date: Fri, 8 Aug 2014 22:34:56 +0200 [thread overview]
Message-ID: <20140808203456.GB5134@pengutronix.de> (raw)
In-Reply-To: <1407448106-1819-1-git-send-email-u.kleine-koenig@pengutronix.de>
On Thu, Aug 07, 2014 at 11:48:24PM +0200, Uwe Kleine-König wrote:
> The ucc_geth_probe function assigns to ug_info->tbi_node and
> ug_info->phy_node a value returned by of_parse_phandle which returns a
> new reference. Put this reference again in the error path of
> ucc_geth_probe and when removing the device.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> No Fixes: footer here. The problem already exists in v2.6.31-rc1 (e.g.
> commit 0b9da337dca9 (net: Rework ucc_geth driver to use of_mdio
> infrastructure)). Didn't continue to research a specific commit.
> ---
> drivers/net/ethernet/freescale/ucc_geth.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
> index 36fc429298e3..5f1aab9c4ee7 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3864,8 +3864,11 @@ static int ucc_geth_probe(struct platform_device* ofdev)
> /* Create an ethernet device instance */
> dev = alloc_etherdev(sizeof(*ugeth));
>
> - if (dev == NULL)
> + if (dev == NULL) {
> + of_node_put(ug_info->tbi_node);
> + of_node_put(ug_info->phy_node);
> return -ENOMEM;
> + }
>
> ugeth = netdev_priv(dev);
> spin_lock_init(&ugeth->lock);
> @@ -3899,6 +3902,8 @@ static int ucc_geth_probe(struct platform_device* ofdev)
> pr_err("%s: Cannot register net device, aborting\n",
> dev->name);
> free_netdev(dev);
> + of_node_put(ug_info->tbi_node);
> + of_node_put(ug_info->phy_node);
> return err;
> }
>
> @@ -3922,6 +3927,8 @@ static int ucc_geth_remove(struct platform_device* ofdev)
> unregister_netdev(dev);
> free_netdev(dev);
> ucc_geth_memclean(ugeth);
> + of_node_put(ugeth->info->tbi_node);
> + of_node_put(ugeth->info->phy_node);
this must read:
of_node_put(ugeth->ug_info->tbi_node);
of_node_put(ugeth->ug_info->phy_node);
otherwise it fails to build.
@davem: Should I send a fixup or a new version?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2014-08-08 20:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-07 21:48 [PATCH 1/3] net: ucc_geth: drop acquired references in probe error path and remove Uwe Kleine-König
2014-08-07 21:48 ` [PATCH 2/3] net: ucc_geth: make probe consistently acquire a reference to the phy node Uwe Kleine-König
2014-08-07 23:07 ` David Miller
2014-08-07 21:48 ` [PATCH 3/3] net: ucc_geth: Don't use the MAC as PHY without a fixed link Uwe Kleine-König
2014-08-07 23:07 ` David Miller
2014-08-07 23:07 ` [PATCH 1/3] net: ucc_geth: drop acquired references in probe error path and remove David Miller
2014-08-08 20:34 ` Uwe Kleine-König [this message]
2014-08-08 20:52 ` David Miller
2014-08-10 18:32 ` [PATCH] net: ucc_geth: fix build failure Uwe Kleine-König
2014-08-11 4:40 ` 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=20140808203456.GB5134@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=leoli@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--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).