[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200513094410.642137919@linuxfoundation.org>
Date: Wed, 13 May 2020 11:44:13 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Andy Shevchenko <andy.shevchenko@...il.com>,
Yash Shah <yash.shah@...ive.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Dejin Zheng <zhengdejin5@...il.com>,
"David S. Miller" <davem@...emloft.net>
Subject: [PATCH 5.4 17/90] net: macb: fix an issue about leak related system resources
From: Dejin Zheng <zhengdejin5@...il.com>
[ Upstream commit b959c77dac09348955f344104c6a921ebe104753 ]
A call of the function macb_init() can fail in the function
fu540_c000_init. The related system resources were not released
then. use devm_platform_ioremap_resource() to replace ioremap()
to fix it.
Fixes: c218ad559020ff9 ("macb: Add support for SiFive FU540-C000")
Cc: Andy Shevchenko <andy.shevchenko@...il.com>
Reviewed-by: Yash Shah <yash.shah@...ive.com>
Suggested-by: Nicolas Ferre <nicolas.ferre@...rochip.com>
Suggested-by: Andy Shevchenko <andy.shevchenko@...il.com>
Signed-off-by: Dejin Zheng <zhengdejin5@...il.com>
Acked-by: Nicolas Ferre <nicolas.ferre@...rochip.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/net/ethernet/cadence/macb_main.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4054,15 +4054,9 @@ static int fu540_c000_clk_init(struct pl
static int fu540_c000_init(struct platform_device *pdev)
{
- struct resource *res;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res)
- return -ENODEV;
-
- mgmt->reg = ioremap(res->start, resource_size(res));
- if (!mgmt->reg)
- return -ENOMEM;
+ mgmt->reg = devm_platform_ioremap_resource(pdev, 1);
+ if (IS_ERR(mgmt->reg))
+ return PTR_ERR(mgmt->reg);
return macb_init(pdev);
}
Powered by blists - more mailing lists