* [PATCH v2] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
@ 2022-12-01 2:35 Qiheng Lin
2022-12-01 9:45 ` AngeloGioacchino Del Regno
2022-12-02 8:42 ` Hans Verkuil
0 siblings, 2 replies; 3+ messages in thread
From: Qiheng Lin @ 2022-12-01 2:35 UTC (permalink / raw)
To: mchehab, matthias.bgg
Cc: angelogioacchino.delregno, linux-media, linux-arm-kernel,
linux-mediatek, linux-kernel, Qiheng Lin
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_return case.
Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
v2:
- Add fix the err_return case.
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index c413e59d4286..48f3e32fe54e 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
}
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;
+ if (IS_ERR(mdp->mdp_mutex[i])) {
+ ret = PTR_ERR(mdp->mdp_mutex[i]);
goto err_return;
}
}
@@ -288,9 +288,10 @@ static int mdp_probe(struct platform_device *pdev)
err_deinit_comp:
mdp_comp_destroy(mdp);
err_return:
- for (i = 0; i < MDP_PIPE_MAX; i++)
- if (mdp)
- mtk_mutex_put(mdp->mdp_mutex[i]);
+ if (mdp)
+ for (i = 0; i < MDP_PIPE_MAX; i++)
+ if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
+ mtk_mutex_put(mdp->mdp_mutex[i]);
kfree(mdp);
dev_dbg(dev, "Errno %d\n", ret);
return ret;
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
2022-12-01 2:35 [PATCH v2] media: platform: mtk-mdp3: Fix return value check in mdp_probe() Qiheng Lin
@ 2022-12-01 9:45 ` AngeloGioacchino Del Regno
2022-12-02 8:42 ` Hans Verkuil
1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-12-01 9:45 UTC (permalink / raw)
To: Qiheng Lin, mchehab, matthias.bgg
Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel
Il 01/12/22 03:35, Qiheng Lin ha scritto:
> 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_return case.
>
> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
Thanks!
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
2022-12-01 2:35 [PATCH v2] media: platform: mtk-mdp3: Fix return value check in mdp_probe() Qiheng Lin
2022-12-01 9:45 ` AngeloGioacchino Del Regno
@ 2022-12-02 8:42 ` Hans Verkuil
1 sibling, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2022-12-02 8:42 UTC (permalink / raw)
To: Qiheng Lin, mchehab, matthias.bgg
Cc: angelogioacchino.delregno, linux-media, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Qiheng,
Can you rebase on top of the latest staging tree? (https://git.linuxtv.org/media_stage.git/)
This patch no longer applies.
Thanks!
Hans
On 01/12/2022 03:35, Qiheng Lin wrote:
> 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_return case.
>
> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
>
> v2:
> - Add fix the err_return case.
>
> drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> index c413e59d4286..48f3e32fe54e 100644
> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> @@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
> }
> 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;
> + if (IS_ERR(mdp->mdp_mutex[i])) {
> + ret = PTR_ERR(mdp->mdp_mutex[i]);
> goto err_return;
> }
> }
> @@ -288,9 +288,10 @@ static int mdp_probe(struct platform_device *pdev)
> err_deinit_comp:
> mdp_comp_destroy(mdp);
> err_return:
> - for (i = 0; i < MDP_PIPE_MAX; i++)
> - if (mdp)
> - mtk_mutex_put(mdp->mdp_mutex[i]);
> + if (mdp)
> + for (i = 0; i < MDP_PIPE_MAX; i++)
> + if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
> + mtk_mutex_put(mdp->mdp_mutex[i]);
> kfree(mdp);
> dev_dbg(dev, "Errno %d\n", ret);
> return ret;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-02 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 2:35 [PATCH v2] media: platform: mtk-mdp3: Fix return value check in mdp_probe() Qiheng Lin
2022-12-01 9:45 ` AngeloGioacchino Del Regno
2022-12-02 8:42 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).