From nobody Mon Sep 29 21:19:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84113C25B08 for ; Mon, 15 Aug 2022 23:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346294AbiHOXjV (ORCPT ); Mon, 15 Aug 2022 19:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353829AbiHOXgm (ORCPT ); Mon, 15 Aug 2022 19:36:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2F79BCCE0; Mon, 15 Aug 2022 13:09:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 464F1B810C5; Mon, 15 Aug 2022 20:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91591C433C1; Mon, 15 Aug 2022 20:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594157; bh=x6NVRyUZTEf4nFxk/dq0sp7TxgAoTWMakjs1/z/O3Hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWr66RVgxtEIgrdSC8gPSLzFo539WRNIW3i+3eVredzpYVVDCRV5hur8TXjnggx5+ V2aED5Lj8blo/kFL480oVWvjCcpKD4MfahwA1r7/PJ2+YPJVMJaqrl2pr/Vi9iPdTt DdaJ2+T12WKVZ9G6sjhC+gstkx/foS1PMnLKHEBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 0374/1157] media: amphion: return error if format is unsupported by vpu Date: Mon, 15 Aug 2022 19:55:30 +0200 Message-Id: <20220815180454.682192679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ 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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vpu_malone.c | 2 ++ drivers/media/platform/amphion/vpu_v4l2.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/pl= atform/amphion/vpu_malone.c index f29c223eefce..40267c73b1f9 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -610,6 +610,8 @@ static int vpu_malone_set_params(struct vpu_shared_addr= *shared, enum vpu_malone_format malone_format; =20 malone_format =3D vpu_malone_format_remap(params->codec_format); + if (WARN_ON(malone_format =3D=3D MALONE_FMT_NULL)) + return -EINVAL; iface->udata_buffer[instance].base =3D params->udata.base; iface->udata_buffer[instance].slot_size =3D params->udata.size; =20 diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 446f07d09d0b..da455e5ab337 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -500,10 +500,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 =3D 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); =20 - return 0; + return ret; } =20 static void vpu_vb2_stop_streaming(struct vb2_queue *q) --=20 2.35.1