* [PATCH] mfd: ti_am335x_tscadc: Fix struct clk memory leak
@ 2018-07-04 4:35 Zumeng Chen
2018-07-04 7:58 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Zumeng Chen @ 2018-07-04 4:35 UTC (permalink / raw)
To: lee.jones, rachna, tony, linux-kernel, linux-omap; +Cc: Zumeng Chen
Use devm_elk_get() to let Linux manage struct clk memory to avoid the following
memory leakage report:
unreferenced object 0xdd75efc0 (size 64):
comm "systemd-udevd", pid 186, jiffies 4294945126 (age 1195.750s)
hex dump (first 32 bytes):
61 64 63 5f 74 73 63 5f 66 63 6b 00 00 00 00 00 adc_tsc_fck.....
00 00 00 00 92 03 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<c0a15260>] kmemleak_alloc+0x40/0x74
[<c0287a10>] __kmalloc_track_caller+0x198/0x388
[<c0255610>] kstrdup+0x40/0x5c
[<c025565c>] kstrdup_const+0x30/0x3c
[<c0636630>] __clk_create_clk+0x60/0xac
[<c0630918>] clk_get_sys+0x74/0x144
[<c0630cdc>] clk_get+0x5c/0x68
[<bf0ac540>] ti_tscadc_probe+0x260/0x468 [ti_am335x_tscadc]
[<c06f3c0c>] platform_drv_probe+0x60/0xac
[<c06f1abc>] driver_probe_device+0x214/0x2dc
[<c06f1c18>] __driver_attach+0x94/0xc0
[<c06efe2c>] bus_for_each_dev+0x90/0xa0
[<c06f1470>] driver_attach+0x28/0x30
[<c06f1030>] bus_add_driver+0x184/0x1ec
[<c06f2b74>] driver_register+0xb0/0xf0
[<c06f3b4c>] __platform_driver_register+0x40/0x54
Signed-off-by: Zumeng Chen <zumeng.chen@gmail.com>
---
drivers/mfd/ti_am335x_tscadc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 47012c0..7a30546 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -209,14 +209,13 @@ static int ti_tscadc_probe(struct platform_device *pdev)
* The TSC_ADC_SS controller design assumes the OCP clock is
* at least 6x faster than the ADC clock.
*/
- clk = clk_get(&pdev->dev, "adc_tsc_fck");
+ clk = devm_clk_get(&pdev->dev, "adc_tsc_fck");
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "failed to get TSC fck\n");
err = PTR_ERR(clk);
goto err_disable_clk;
}
clock_rate = clk_get_rate(clk);
- clk_put(clk);
tscadc->clk_div = clock_rate / ADC_CLK;
/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: ti_am335x_tscadc: Fix struct clk memory leak
2018-07-04 4:35 [PATCH] mfd: ti_am335x_tscadc: Fix struct clk memory leak Zumeng Chen
@ 2018-07-04 7:58 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2018-07-04 7:58 UTC (permalink / raw)
To: Zumeng Chen; +Cc: rachna, tony, linux-kernel, linux-omap
On Wed, 04 Jul 2018, Zumeng Chen wrote:
> Use devm_elk_get() to let Linux manage struct clk memory to avoid the following
> memory leakage report:
>
> unreferenced object 0xdd75efc0 (size 64):
> comm "systemd-udevd", pid 186, jiffies 4294945126 (age 1195.750s)
> hex dump (first 32 bytes):
> 61 64 63 5f 74 73 63 5f 66 63 6b 00 00 00 00 00 adc_tsc_fck.....
> 00 00 00 00 92 03 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<c0a15260>] kmemleak_alloc+0x40/0x74
> [<c0287a10>] __kmalloc_track_caller+0x198/0x388
> [<c0255610>] kstrdup+0x40/0x5c
> [<c025565c>] kstrdup_const+0x30/0x3c
> [<c0636630>] __clk_create_clk+0x60/0xac
> [<c0630918>] clk_get_sys+0x74/0x144
> [<c0630cdc>] clk_get+0x5c/0x68
> [<bf0ac540>] ti_tscadc_probe+0x260/0x468 [ti_am335x_tscadc]
> [<c06f3c0c>] platform_drv_probe+0x60/0xac
> [<c06f1abc>] driver_probe_device+0x214/0x2dc
> [<c06f1c18>] __driver_attach+0x94/0xc0
> [<c06efe2c>] bus_for_each_dev+0x90/0xa0
> [<c06f1470>] driver_attach+0x28/0x30
> [<c06f1030>] bus_add_driver+0x184/0x1ec
> [<c06f2b74>] driver_register+0xb0/0xf0
> [<c06f3b4c>] __platform_driver_register+0x40/0x54
>
> Signed-off-by: Zumeng Chen <zumeng.chen@gmail.com>
> ---
> drivers/mfd/ti_am335x_tscadc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied, thanks.
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-04 7:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04 4:35 [PATCH] mfd: ti_am335x_tscadc: Fix struct clk memory leak Zumeng Chen
2018-07-04 7:58 ` Lee Jones
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).