• Srinivas Kandagatla's avatar
    drivers: thermal: qcom: tsens: Fix memory leak from qfprom read · 6b8249ab
    Srinivas Kandagatla authored
    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: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Acked-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
    Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
    6b8249ab
tsens-v0_1.c 10.8 KB