media: platform: mtk-mdp3: Fix return value check in mdp_probe()

[ Upstream commit 1963689bed ]

In case of error, the function mtk_mutex_get()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().
And also fix the err_free_mutex case.

Fixes: 61890ccaef ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Qiheng Lin
2022-12-02 11:18:36 +01:00
committed by Greg Kroah-Hartman
parent 9ffaf55e12
commit e68b43980a

View File

@@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
} }
for (i = 0; i < MDP_PIPE_MAX; i++) { for (i = 0; i < MDP_PIPE_MAX; i++) {
mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev); mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
if (!mdp->mdp_mutex[i]) { if (IS_ERR(mdp->mdp_mutex[i])) {
ret = -ENODEV; ret = PTR_ERR(mdp->mdp_mutex[i]);
goto err_free_mutex; goto err_free_mutex;
} }
} }
@@ -289,7 +289,8 @@ err_deinit_comp:
mdp_comp_destroy(mdp); mdp_comp_destroy(mdp);
err_free_mutex: err_free_mutex:
for (i = 0; i < MDP_PIPE_MAX; i++) for (i = 0; i < MDP_PIPE_MAX; i++)
mtk_mutex_put(mdp->mdp_mutex[i]); if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
mtk_mutex_put(mdp->mdp_mutex[i]);
err_destroy_device: err_destroy_device:
kfree(mdp); kfree(mdp);
err_return: err_return: