diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2019-08-23 10:38:35 +0100 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2019-08-28 21:05:08 +0800 |
commit | 6b8249abb093551ef173d13a25ed0044d5dd33e0 (patch) | |
tree | 3215129ac038f464d7289e1a86ec756fadd4e136 /drivers/thermal/qcom/tsens-v1.c | |
parent | 9d6b4b871dcfd6796b46a05e002884e051687e47 (diff) | |
download | linux-6b8249abb093551ef173d13a25ed0044d5dd33e0.tar.bz2 |
drivers: thermal: qcom: tsens: Fix memory leak from qfprom read
memory returned as part of nvmem_read via qfprom_read should be
freed by the consumer once done.
Existing code is not doing it so fix it.
Below memory leak detected by kmemleak
[<ffffff80088b7658>] kmemleak_alloc+0x50/0x84
[<ffffff80081df120>] __kmalloc+0xe8/0x168
[<ffffff80086db350>] nvmem_cell_read+0x30/0x80
[<ffffff8008632790>] qfprom_read+0x4c/0x7c
[<ffffff80086335a4>] calibrate_v1+0x34/0x204
[<ffffff8008632518>] tsens_probe+0x164/0x258
[<ffffff80084e0a1c>] platform_drv_probe+0x80/0xa0
[<ffffff80084de4f4>] really_probe+0x208/0x248
[<ffffff80084de2c4>] driver_probe_device+0x98/0xc0
[<ffffff80084dec54>] __device_attach_driver+0x9c/0xac
[<ffffff80084dca74>] bus_for_each_drv+0x60/0x8c
[<ffffff80084de634>] __device_attach+0x8c/0x100
[<ffffff80084de6c8>] device_initial_probe+0x20/0x28
[<ffffff80084dcbb8>] bus_probe_device+0x34/0x7c
[<ffffff80084deb08>] deferred_probe_work_func+0x6c/0x98
[<ffffff80080c3da8>] process_one_work+0x160/0x2f8
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/qcom/tsens-v1.c')
-rw-r--r-- | drivers/thermal/qcom/tsens-v1.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index 10b595d4f619..870f502f2cb6 100644 --- a/drivers/thermal/qcom/tsens-v1.c +++ b/drivers/thermal/qcom/tsens-v1.c @@ -138,6 +138,7 @@ static int calibrate_v1(struct tsens_priv *priv) } compute_intercept_slope(priv, p1, p2, mode); + kfree(qfprom_cdata); return 0; } |