mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
media: platform: mtk-mdp3: fix error handling in mdp_probe()
Adjust label "err_return" order to avoid double freeing, and
add two labels for easy traceability.
Fixes: 61890ccaef ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
74a596e7fc
commit
82b7d4b5d3
|
|
@ -196,27 +196,27 @@ static int mdp_probe(struct platform_device *pdev)
|
|||
mm_pdev = __get_pdev_by_id(pdev, MDP_INFRA_MMSYS);
|
||||
if (!mm_pdev) {
|
||||
ret = -ENODEV;
|
||||
goto err_return;
|
||||
goto err_destroy_device;
|
||||
}
|
||||
mdp->mdp_mmsys = &mm_pdev->dev;
|
||||
|
||||
mm_pdev = __get_pdev_by_id(pdev, MDP_INFRA_MUTEX);
|
||||
if (WARN_ON(!mm_pdev)) {
|
||||
ret = -ENODEV;
|
||||
goto err_return;
|
||||
goto err_destroy_device;
|
||||
}
|
||||
for (i = 0; i < MDP_PIPE_MAX; i++) {
|
||||
mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
|
||||
if (!mdp->mdp_mutex[i]) {
|
||||
ret = -ENODEV;
|
||||
goto err_return;
|
||||
goto err_free_mutex;
|
||||
}
|
||||
}
|
||||
|
||||
ret = mdp_comp_config(mdp);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to config mdp components\n");
|
||||
goto err_return;
|
||||
goto err_free_mutex;
|
||||
}
|
||||
|
||||
mdp->job_wq = alloc_workqueue(MDP_MODULE_NAME, WQ_FREEZABLE, 0);
|
||||
|
|
@ -287,11 +287,12 @@ static int mdp_probe(struct platform_device *pdev)
|
|||
destroy_workqueue(mdp->job_wq);
|
||||
err_deinit_comp:
|
||||
mdp_comp_destroy(mdp);
|
||||
err_return:
|
||||
err_free_mutex:
|
||||
for (i = 0; i < MDP_PIPE_MAX; i++)
|
||||
if (mdp)
|
||||
mtk_mutex_put(mdp->mdp_mutex[i]);
|
||||
mtk_mutex_put(mdp->mdp_mutex[i]);
|
||||
err_destroy_device:
|
||||
kfree(mdp);
|
||||
err_return:
|
||||
dev_dbg(dev, "Errno %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user