summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2021-03-05 11:23:54 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-04-15 14:23:26 +0300
commit0b276e470a4d43e1365d3eb53c608a3d208cabd4 (patch)
tree4ccac562768bca7cc0ccc9ad63a995f202f7f134 /drivers/media
parentac746729178bd7c08bb7e5242df92bd01593a732 (diff)
downloadlinux-0b276e470a4d43e1365d3eb53c608a3d208cabd4.tar.xz
media: coda: fix macroblocks count control usage
Commit b2d3bef1aa78 ("media: coda: Add a V4L2 user for control error macroblocks count") add the control for the decoder devices. But during streamon() this ioctl gets called for all (encoder and decoder) devices and on encoder devices this causes a null pointer exception. Fix this by setting the control only if it is really accessible. Fixes: b2d3bef1aa78 ("media: coda: Add a V4L2 user for control error macroblocks count") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Cc: <stable@vger.kernel.org> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/coda/coda-common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index ccb4d3f4804e..bd666c858fa1 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -2062,7 +2062,9 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
if (q_data_dst->fourcc == V4L2_PIX_FMT_JPEG)
ctx->params.gop_size = 1;
ctx->gopcounter = ctx->params.gop_size - 1;
- v4l2_ctrl_s_ctrl(ctx->mb_err_cnt_ctrl, 0);
+ /* Only decoders have this control */
+ if (ctx->mb_err_cnt_ctrl)
+ v4l2_ctrl_s_ctrl(ctx->mb_err_cnt_ctrl, 0);
ret = ctx->ops->start_streaming(ctx);
if (ctx->inst_type == CODA_INST_DECODER) {