Commit 6ca5989e authored by Wenwen Wang's avatar Wenwen Wang Committed by Mauro Carvalho Chehab

media: ti-vpe: Add cleanup in vpdma_list_cleanup()

If an error occurs in this function, no cleanup is executed, leading to
memory/resource leaks. To fix this issue, introduce two labels to perform
the cleanup work.
Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 51d47e57
......@@ -445,23 +445,25 @@ int vpdma_list_cleanup(struct vpdma_data *vpdma, int list_num,
ret = vpdma_map_desc_buf(vpdma, &abort_list.buf);
if (ret)
return ret;
goto free_desc;
ret = vpdma_submit_descs(vpdma, &abort_list, list_num);
if (ret)
return ret;
goto unmap_desc;
while (vpdma_list_busy(vpdma, list_num) && --timeout)
;
if (timeout == 0) {
dev_err(&vpdma->pdev->dev, "Timed out cleaning up VPDMA list\n");
return -EBUSY;
ret = -EBUSY;
}
unmap_desc:
vpdma_unmap_desc_buf(vpdma, &abort_list.buf);
free_desc:
vpdma_free_desc_buf(&abort_list.buf);
return 0;
return ret;
}
EXPORT_SYMBOL(vpdma_list_cleanup);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment