Skip to contentSkip to conversation

media: platform: mtk-mdp3: fix uninitialized variable in mdp_path_config()

PATCH In review Moudy Ho 2 participants 2 messages Oct 11, 2023 – Oct 12, 2023

Subsystems (2)
lore
Share & tools
lore

Moudy Ho

author
#0 lore raw

PATCH 1/1 media: platform: mtk-mdp3: fix uninitialized variable in mdp_path_config()

Fix the build warnings that were detected by the linux-media build scripts tool:

drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:
In function 'mdp_path_config.isra':
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:

	warning: 'ctx' may be used uninitialized [-Wmaybe-uninitialized]
      |                    out = CFG_COMP(MT8195, ctx->param, outputs[0]);
      |                                           ~~~^~~~~~~
drivers/media/platform/mediatek/mdp3/mtk-img-ipi.h: note:
	in definition of macro 'CFG_COMP'
      |         (IS_ERR_OR_NULL(comp) ? 0 : _CFG_COMP(plat, comp, mem))
      |                         ^~~~
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:
	note: 'ctx' was declared here
      |         struct mdp_comp_ctx *ctx;
      |
Fixes 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
---
 drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +1 -1
index 3177592490be..6adac857a477 100644
@@ -261,11 +261,11 @@ static int mdp_path_config(struct mdp_dev *mdp, struct mdp_cmdq_cmd *cmd,
 		const struct v4l2_rect *compose;
 		u32 out = 0;
 
+		ctx = &path->comps[index];
 		if (CFG_CHECK(MT8183, p_id))
 			out = CFG_COMP(MT8183, ctx->param, outputs[0]);
 
 		compose = path->composes[out];
-		ctx = &path->comps[index];
 		ret = call_op(ctx, config_frame, cmd, compose);
 		if (ret)
 			return ret;
Signature · 1 line
2.18.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Il 11/10/23 05:00, Moudy Ho ha scritto:

Quoted 18 lines

Fix the build warnings that were detected by the linux-media build scripts tool:

drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:
In function 'mdp_path_config.isra':
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:

	warning: 'ctx' may be used uninitialized [-Wmaybe-uninitialized]
       |                    out = CFG_COMP(MT8195, ctx->param, outputs[0]);
       |                                           ~~~^~~~~~~
drivers/media/platform/mediatek/mdp3/mtk-img-ipi.h: note:
	in definition of macro 'CFG_COMP'
       |         (IS_ERR_OR_NULL(comp) ? 0 : _CFG_COMP(plat, comp, mem))
       |                         ^~~~
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c:
	note: 'ctx' was declared here
       |         struct mdp_comp_ctx *ctx;
       |
Quoted 2 lines
Fixes 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")