remoteproc/ste: fix memory leak on shutdown
Fixes coherent memory leakage, caused by non-deallocated firmware image chunk. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Acked-by: Ido Yariv <ido@wizery.com> [slightly edit subject and commit log] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
This commit is contained in:
Родитель
b39599b7cb
Коммит
1cd425b660
|
@ -240,6 +240,8 @@ static int sproc_drv_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
/* Unregister as remoteproc device */
|
/* Unregister as remoteproc device */
|
||||||
rproc_del(sproc->rproc);
|
rproc_del(sproc->rproc);
|
||||||
|
dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE,
|
||||||
|
sproc->fw_addr, sproc->fw_dma_addr);
|
||||||
rproc_put(sproc->rproc);
|
rproc_put(sproc->rproc);
|
||||||
|
|
||||||
mdev->drv_data = NULL;
|
mdev->drv_data = NULL;
|
||||||
|
@ -297,10 +299,13 @@ static int sproc_probe(struct platform_device *pdev)
|
||||||
/* Register as a remoteproc device */
|
/* Register as a remoteproc device */
|
||||||
err = rproc_add(rproc);
|
err = rproc_add(rproc);
|
||||||
if (err)
|
if (err)
|
||||||
goto free_rproc;
|
goto free_mem;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
free_mem:
|
||||||
|
dma_free_coherent(rproc->dev.parent, SPROC_FW_SIZE,
|
||||||
|
sproc->fw_addr, sproc->fw_dma_addr);
|
||||||
free_rproc:
|
free_rproc:
|
||||||
/* Reset device data upon error */
|
/* Reset device data upon error */
|
||||||
mdev->drv_data = NULL;
|
mdev->drv_data = NULL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче