Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] media: mediatek: vcodec: avoid accessing a failed control
@ 2026-09-11  6:09 Slavin Liu
  0 siblings, 0 replies; only message in thread
From: Slavin Liu @ 2026-09-11  6:09 UTC (permalink / raw)
  To: tiffany.lin, andrew-ct.chen, yunfei.dong, mchehab, matthias.bgg,
	angelogioacchino.delregno
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-mediatek,
	bolin.liu

Set the volatile flag only if the control was created. The existing
handler error path remains responsible for reporting allocation errors.

Detected by static analysis and reviewed with AI-assisted source auditing.

Fixes: 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
 .../platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
index aa9bdee7a96c..8441f1d69d2f 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
@@ -555,7 +555,8 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_dec_ctx *ctx)
 
 	ctrl = v4l2_ctrl_new_std(&ctx->ctrl_hdl, &mtk_vcodec_dec_ctrl_ops,
 				 V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 0, 32, 1, 1);
-	ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
+	if (ctrl)
+		ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
 	v4l2_ctrl_new_std_menu(&ctx->ctrl_hdl, &mtk_vcodec_dec_ctrl_ops,
 			       V4L2_CID_MPEG_VIDEO_VP9_PROFILE,
 			       V4L2_MPEG_VIDEO_VP9_PROFILE_0, 0,


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11  6:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11  6:09 [PATCH RFC] media: mediatek: vcodec: avoid accessing a failed control Slavin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox