]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: amphion: return error if format is unsupported by vpu
authorMing Qian <ming.qian@nxp.com>
Thu, 9 Jun 2022 09:27:59 +0000 (10:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:40:49 +0000 (14:40 +0200)
[ Upstream commit a3a2efca36a3a1ddba229a7be7991e8b5de4ac35 ]

return error if format is unsupported by vpu,
otherwise the vpu will be stalled at decoding

Fixes: 3cd084519c6f9 ("media: amphion: add vpu v4l2 m2m support")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/amphion/vpu_malone.c
drivers/media/platform/amphion/vpu_v4l2.c

index 446a9de0cc119b2219167b3de165d8ea4273cea4..d91be0ece961e6adda8dd44b1a00773cdfb8aec1 100644 (file)
@@ -609,6 +609,8 @@ static int vpu_malone_set_params(struct vpu_shared_addr *shared,
        enum vpu_malone_format malone_format;
 
        malone_format = vpu_malone_format_remap(params->codec_format);
+       if (WARN_ON(malone_format == MALONE_FMT_NULL))
+               return -EINVAL;
        iface->udata_buffer[instance].base = params->udata.base;
        iface->udata_buffer[instance].slot_size = params->udata.size;
 
index 9c0704cd57661dde9b3fdfc8af30ef052435f94d..4183a3994d307d7c787f3b716c59bd9f857b2ad9 100644 (file)
@@ -440,10 +440,12 @@ static int vpu_vb2_start_streaming(struct vb2_queue *q, unsigned int count)
                  fmt->sizeimage[1], fmt->bytesperline[1],
                  fmt->sizeimage[2], fmt->bytesperline[2],
                  q->num_buffers);
-       call_void_vop(inst, start, q->type);
+       ret = call_vop(inst, start, q->type);
        vb2_clear_last_buffer_dequeued(q);
+       if (ret)
+               vpu_vb2_buffers_return(inst, q->type, VB2_BUF_STATE_QUEUED);
 
-       return 0;
+       return ret;
 }
 
 static void vpu_vb2_stop_streaming(struct vb2_queue *q)