* [PATCH resend 0/1] net: sun4i-emac: Properly free resources on probe failure
@ 2015-10-20 8:42 Hans de Goede
[not found] ` <1445330544-6968-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2015-10-20 8:42 UTC (permalink / raw)
To: David S. Miller
Cc: Maxime Ripard, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi Davem,
IIRC you said you would pick this up, but I'm not seeing it in net-next,
hence this resend.
Regards,
Hans
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH resend] net: sun4i-emac: Properly free resources on probe failure and remove
[not found] ` <1445330544-6968-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-10-20 8:42 ` Hans de Goede
[not found] ` <1445330544-6968-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-20 11:17 ` [PATCH resend 0/1] net: sun4i-emac: Properly free resources on probe failure David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2015-10-20 8:42 UTC (permalink / raw)
To: David S. Miller
Cc: Maxime Ripard, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
Fix sun4i-emac not releasing the following resources:
-iomapped memory not released on probe-failure nor on remove
-clock not getting disabled on probe-failure nor on remove
-sram not being released on remove
And while at it also add error checking to the clk_prepare_enable call
done on probe.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/net/ethernet/allwinner/sun4i-emac.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 48ce83e..8d50314 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -847,21 +847,25 @@ static int emac_probe(struct platform_device *pdev)
if (ndev->irq == -ENXIO) {
netdev_err(ndev, "No irq resource\n");
ret = ndev->irq;
- goto out;
+ goto out_iounmap;
}
db->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(db->clk)) {
ret = PTR_ERR(db->clk);
- goto out;
+ goto out_iounmap;
}
- clk_prepare_enable(db->clk);
+ ret = clk_prepare_enable(db->clk);
+ if (ret) {
+ dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret);
+ goto out_iounmap;
+ }
ret = sunxi_sram_claim(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "Error couldn't map SRAM to device\n");
- goto out;
+ goto out_clk_disable_unprepare;
}
db->phy_node = of_parse_phandle(np, "phy", 0);
@@ -910,6 +914,10 @@ static int emac_probe(struct platform_device *pdev)
out_release_sram:
sunxi_sram_release(&pdev->dev);
+out_clk_disable_unprepare:
+ clk_disable_unprepare(db->clk);
+out_iounmap:
+ iounmap(db->membase);
out:
dev_err(db->dev, "not found (%d).\n", ret);
@@ -921,8 +929,12 @@ out:
static int emac_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
+ struct emac_board_info *db = netdev_priv(ndev);
unregister_netdev(ndev);
+ sunxi_sram_release(&pdev->dev);
+ clk_disable_unprepare(db->clk);
+ iounmap(db->membase);
free_netdev(ndev);
dev_dbg(&pdev->dev, "released and freed device\n");
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH resend] net: sun4i-emac: Properly free resources on probe failure and remove
[not found] ` <1445330544-6968-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-10-20 9:12 ` Maxime Ripard
2015-10-22 2:48 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2015-10-20 9:12 UTC (permalink / raw)
To: Hans de Goede
Cc: David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
On Tue, Oct 20, 2015 at 10:42:24AM +0200, Hans de Goede wrote:
> Fix sun4i-emac not releasing the following resources:
> -iomapped memory not released on probe-failure nor on remove
> -clock not getting disabled on probe-failure nor on remove
> -sram not being released on remove
>
> And while at it also add error checking to the clk_prepare_enable call
> done on probe.
>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH resend 0/1] net: sun4i-emac: Properly free resources on probe failure
[not found] ` <20151020.041720.1990087005815931941.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
@ 2015-10-20 11:10 ` Hans de Goede
0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2015-10-20 11:10 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi,
On 20-10-15 13:17, David Miller wrote:
> From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Date: Tue, 20 Oct 2015 10:42:23 +0200
>>
>> IIRC you said you would pick this up, but I'm not seeing it in
>> net-next, hence this resend.
>
> If it's not in my tree, and it's not active on patchwork, you really
> have to resend your patches.
>
> Asking me to dig into submissions made some time in the past doesn't
> really work, sorry.
Right, that is why this mail was 0/1 it was just a cover-page,
there is a 2nd mail in the thread with the actual patch.
Regards,
Hans
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH resend 0/1] net: sun4i-emac: Properly free resources on probe failure
[not found] ` <1445330544-6968-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-20 8:42 ` [PATCH resend] net: sun4i-emac: Properly free resources on probe failure and remove Hans de Goede
@ 2015-10-20 11:17 ` David Miller
[not found] ` <20151020.041720.1990087005815931941.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2015-10-20 11:17 UTC (permalink / raw)
To: hdegoede-H+wXaHxf7aLQT0dZR+AlfA
Cc: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Tue, 20 Oct 2015 10:42:23 +0200
>
> IIRC you said you would pick this up, but I'm not seeing it in
> net-next, hence this resend.
If it's not in my tree, and it's not active on patchwork, you really
have to resend your patches.
Asking me to dig into submissions made some time in the past doesn't
really work, sorry.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH resend] net: sun4i-emac: Properly free resources on probe failure and remove
[not found] ` <1445330544-6968-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-20 9:12 ` Maxime Ripard
@ 2015-10-22 2:48 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2015-10-22 2:48 UTC (permalink / raw)
To: hdegoede-H+wXaHxf7aLQT0dZR+AlfA
Cc: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Tue, 20 Oct 2015 10:42:24 +0200
> Fix sun4i-emac not releasing the following resources:
> -iomapped memory not released on probe-failure nor on remove
> -clock not getting disabled on probe-failure nor on remove
> -sram not being released on remove
>
> And while at it also add error checking to the clk_prepare_enable call
> done on probe.
>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-22 2:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 8:42 [PATCH resend 0/1] net: sun4i-emac: Properly free resources on probe failure Hans de Goede
[not found] ` <1445330544-6968-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-20 8:42 ` [PATCH resend] net: sun4i-emac: Properly free resources on probe failure and remove Hans de Goede
[not found] ` <1445330544-6968-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-20 9:12 ` Maxime Ripard
2015-10-22 2:48 ` David Miller
2015-10-20 11:17 ` [PATCH resend 0/1] net: sun4i-emac: Properly free resources on probe failure David Miller
[not found] ` <20151020.041720.1990087005815931941.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2015-10-20 11:10 ` Hans de Goede
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).