Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3028399rwb; Mon, 15 Aug 2022 16:26:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Ki0heYd6ARyPG8rgsfUXjb9/MOArtjNp/rtYfcKFnNrAsEPnkIbfhJtu+KsIzAFxRVyRB X-Received: by 2002:a17:907:2c47:b0:730:8bbb:69a8 with SMTP id hf7-20020a1709072c4700b007308bbb69a8mr12155699ejc.38.1660605890472; Mon, 15 Aug 2022 16:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605890; cv=none; d=google.com; s=arc-20160816; b=UrPTA2IfdGYXhx0yCswgUWJdJukLX2DbTuHYC0O/pRuQ6BR5dnok9saTudui67Ntoz 0h1UCTQaibhYmgij/O0Kdy4E3Ugr9j09FeMoIHy4Er5wIN59Vl8/vdpSbVUvr9lJ9N6H pozORxnWX4LP0ds2Lsv5yOO1ieHlYN9jfFHMpZ3scUyEfNRYNYoeec50vSS5FRDV2l2F LbZPsSi8u/DBUTs1q0iLJD09aoP0+13JZMauYjHoQf48UJ1cq27QOLsuxn/ENIMVfRAg hBrBDbyqN/uESkDmSPyxNuk7lRqxUsOryGw9It3PmYtZG2b5jD9U9higuHZDVwXlMHT7 NXpg== 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=L5QPZO69EraehMfhRvdWtbpWFUbK79Gi7aGzeUgqfBA=; b=vQEGU2DC1cUTJtPrYUegKbf5KUrRnpGNFYB10vwsFjjyb0ZItmi1L6L0ipKOvhAIT4 jKjVMlKlvazZjMEf1u3o41WjtHgBEGiA6QeX36PMMKygVTCdwN8gDKjAw5rPVbnaNGF4 7vBRmoN2flVt8bzHafmgiRIml6A/cdZPWrsDr8nJYnJVeRpuZgQNH9F1sA/Eatntx8Qh JYWPRMT4YJv7ZQlYRACsfsiAGC5pABWzNpXwSgfReZNEVrwf8lOHoVDUliR2K3Elx9C1 +lJ/YHagy6n4LhZmcgnD6bO0d9pQpON8e8T9KO/I7Ae7uOzLRPVCxTELtxrVXz0G/GxS x3Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a5LfUXwd; 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 p2-20020a17090635c200b0072f664f368asi8804950ejb.199.2022.08.15.16.24.25; Mon, 15 Aug 2022 16:24:50 -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=a5LfUXwd; 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 S1343877AbiHOU6k (ORCPT + 99 others); Mon, 15 Aug 2022 16:58:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347038AbiHOU4O (ORCPT ); Mon, 15 Aug 2022 16:56:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CDCE3C172; Mon, 15 Aug 2022 12:12:05 -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 dfw.source.kernel.org (Postfix) with ESMTPS id CCDD560BC2; Mon, 15 Aug 2022 19:12:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C48C433D6; Mon, 15 Aug 2022 19:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590724; bh=7ipuau29OrxC/JxYf2KFZ2+Br8E6WRvnE93hYM3LSwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5LfUXwd7uLT0eudp5Y6skffQ9vSEPzvEK749bwgvp4cKT36W2GvMpg1nnYCXmhM7 WxKAt10YNg0sZV/FClXXbyHUErSUCMqb1rWnVV35kOm0gm7EajRNCr0KlDYrgyoTtK 4D+6ZvrBgso2KfJ7AsTik6MtWQaEGlpugC5ytjTM= 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.18 0350/1095] media: amphion: return error if format is unsupported by vpu Date: Mon, 15 Aug 2022 19:55:49 +0200 Message-Id: <20220815180444.248436828@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 446a9de0cc11..d91be0ece961 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -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; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 9c0704cd5766..4183a3994d30 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -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) -- 2.35.1