Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3124311rwb; Mon, 15 Aug 2022 18:43:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xCDjYhfgXO86xJLALHvVJE1JVvY9KN7zS655VHTITSQvYz4mbTFqFeXzZg/1FFFI1JYpV X-Received: by 2002:a05:6402:3492:b0:43e:9666:ece2 with SMTP id v18-20020a056402349200b0043e9666ece2mr17015053edc.65.1660614238904; Mon, 15 Aug 2022 18:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614238; cv=none; d=google.com; s=arc-20160816; b=qt/pnJsE9MPNSCt1r+2lLCYpj4hRmOyB9ffx9mcDbgId5tbDQhjpJ6+SV0x30wpi2v TTekSGe9oMUYWZKGuPLyOrAIdPOldnQpfAK7mXyo6kdtscEAeXpm96anhkbH7ao20O7W dyJmJquA4Oh0sQMiXCT1/6PmgFQdTVn9Lk1T1a2O32nUJPwzIOtf8WZBYKvRUx2wPeRM c2wdR4WZvxb8l6XTYU86fHaX31N0qFZZvlmcT8AnNbeA0MfFo+GOy6qMdFMpa3R8BIcY /AvgQ9JE30SdnVnEeRAWJ2/R4mllls+Vo3Na/QUJCL0kTz3MiS5DFOvLhQGEQgCiVjCZ Q5iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1CYKiPm/qsvTiSd3kTd72bqYtEEwagp7b3yDC3ZoMk4=; b=Ekg2cD7eZBFZZ4vVOdwO+md15QUj8IyotinCSeHe+7XUEYGweTxQkaAgJlsrfGBPJV k4uvtnSJ8JWVi2IWNuoUPKtljc0xujMXgXoDA4rsvUA5dRUhFJSWV7braeGLUze1aUaY h+FjJ3EJV5YR/N+bPblyZDBp0ckspTKpgWlCiNjw4tY6CbvOxYL8dPNglVwvCJZafXCw 05USFEsv976RUYtDAwJHpUQcqr5sTmnsSZ7PMhvXGkWEA+PITjonb0dtJe3f1T0XwXFi KLHBNxLjvvtOdfe9nAHb7hk/yri5PaEq27xGbuRMbFT+VkIEg/0YR5am4AWr3cqjollK 59OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DWr66RVg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go16-20020a1709070d9000b0072f1f3ec581si11120019ejc.264.2022.08.15.18.43.33; Mon, 15 Aug 2022 18:43:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DWr66RVg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353905AbiHOXjV (ORCPT + 99 others); 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/platform/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; 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; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/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 = 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) -- 2.35.1