* [PATCH] media: platform: mtk-mdp3: Remove unwanted else in mdp-cmdp-prepare()
@ 2024-10-16 11:38 Mohammed Anees
2024-10-17 13:39 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 3+ messages in thread
From: Mohammed Anees @ 2024-10-16 11:38 UTC (permalink / raw)
To: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek
Cc: Mauro Carvalho Chehab, Matthias Brugger,
AngeloGioacchino Del Regno, Sebastian Fricke, Moudy Ho,
Ricardo Ribalda, Mohammed Anees
Since platform compatibility is already verified, the
additional else branch is unnecessary and will never
be executed. To fix, remove this else condition.
Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
---
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
index ea2ea119dd2a..168beed4155a 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
@@ -624,14 +624,11 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
if (ret)
goto err_free_cmd;
- if (CFG_CHECK(MT8183, p_id)) {
+ if (CFG_CHECK(MT8183, p_id))
num_comp = CFG_GET(MT8183, param->config, num_components);
- } else if (CFG_CHECK(MT8195, p_id)) {
+ else if (CFG_CHECK(MT8195, p_id))
num_comp = CFG_GET(MT8195, param->config, num_components);
- } else {
- ret = -EINVAL;
- goto err_destroy_pkt;
- }
+
comps = kcalloc(num_comp, sizeof(*comps), GFP_KERNEL);
if (!comps) {
ret = -ENOMEM;
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: platform: mtk-mdp3: Remove unwanted else in mdp-cmdp-prepare()
2024-10-16 11:38 [PATCH] media: platform: mtk-mdp3: Remove unwanted else in mdp-cmdp-prepare() Mohammed Anees
@ 2024-10-17 13:39 ` AngeloGioacchino Del Regno
2024-10-17 20:21 ` Mohammed Anees
0 siblings, 1 reply; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-10-17 13:39 UTC (permalink / raw)
To: Mohammed Anees, linux-media, linux-kernel, linux-arm-kernel,
linux-mediatek
Cc: Mauro Carvalho Chehab, Matthias Brugger, Sebastian Fricke,
Moudy Ho, Ricardo Ribalda
Il 16/10/24 13:38, Mohammed Anees ha scritto:
> Since platform compatibility is already verified, the
> additional else branch is unnecessary and will never
> be executed. To fix, remove this else condition.
Well, actually, even the one before the allocation of cmd can be removed,
because compatibility is already checked by __get_config_offset().
Besides, __get_config_offset() has another occurrence of an unneeded
else branch, as it's checking platform twice.... so you can clean up
that one as well.
P.S.: "media: platform: mtk-mdp3: cmdq: Remove duplicated platforms checks"
Cheers,
Angelo
>
> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
> ---
> drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> index ea2ea119dd2a..168beed4155a 100644
> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> @@ -624,14 +624,11 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
> if (ret)
> goto err_free_cmd;
>
> - if (CFG_CHECK(MT8183, p_id)) {
> + if (CFG_CHECK(MT8183, p_id))
> num_comp = CFG_GET(MT8183, param->config, num_components);
> - } else if (CFG_CHECK(MT8195, p_id)) {
> + else if (CFG_CHECK(MT8195, p_id))
> num_comp = CFG_GET(MT8195, param->config, num_components);
> - } else {
> - ret = -EINVAL;
> - goto err_destroy_pkt;
> - }
> +
> comps = kcalloc(num_comp, sizeof(*comps), GFP_KERNEL);
> if (!comps) {
> ret = -ENOMEM;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: platform: mtk-mdp3: Remove unwanted else in mdp-cmdp-prepare()
2024-10-17 13:39 ` AngeloGioacchino Del Regno
@ 2024-10-17 20:21 ` Mohammed Anees
0 siblings, 0 replies; 3+ messages in thread
From: Mohammed Anees @ 2024-10-17 20:21 UTC (permalink / raw)
To: angelogioacchino.delregno
Cc: linux-arm-kernel, linux-kernel, linux-media, linux-mediatek,
matthias.bgg, mchehab, moudy.ho, pvmohammedanees2003, ribalda,
sebastian.fricke
Thank you for your feedback! I have made the
required changes and sent over the new one.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-17 20:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16 11:38 [PATCH] media: platform: mtk-mdp3: Remove unwanted else in mdp-cmdp-prepare() Mohammed Anees
2024-10-17 13:39 ` AngeloGioacchino Del Regno
2024-10-17 20:21 ` Mohammed Anees
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).