Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13426239ybl; Sun, 29 Dec 2019 11:35:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwvJnc7/4aQasRrc+PjXu2GtUpSGeSq11hz4xudh5fW4uaDnE8J7eG249qbCf/EzIuUsNIi X-Received: by 2002:a05:6830:1185:: with SMTP id u5mr65645574otq.147.1577648140982; Sun, 29 Dec 2019 11:35:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577648140; cv=none; d=google.com; s=arc-20160816; b=TTlCjvIJx5OSEO/NIDC1QYgF47GHlOvLmaH2bKFqlEsenfhTOy7l0zeUx5BIXGp5bb 3hEf57P4HeEeUy14Gb8slHR83dENqszMkO/lbyC1FkCUxZ6NFuCRE8I/WkjTl3vX6x+B Dokhy+KTRNDVjUR2fef6VilXVdAJ95eD/RcTRPNkczpYVqZADMGiNtNEucsjXt93CbEE NtNfn8fU47e4d6LgDwc7x6ac4XJ2R+QITlcz4kzptixJSedDeLktd/Vsn6T06t1IxKBE T18/DjiRv0DiKPZ5lHii3FyKBG480rhswhP7LMgpr27P3yZUj1r9Ew0INp6FPHpmlMJO 7i3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MLSSKjPGtGK/NvL+0meWvHSWmsMqg/r5JscVPLMp8Uw=; b=EwZqHydLeqlSlDcYQ6AHrJdVWbLDLaKKD3+uNwQivEASTcZl5vwkcFt2uDES1Yz8G6 hCxORWHP8rAKMBbtCJSPSSdx3t5KqGuuy4clE80PhPyxWvWy6yaBCCF060bEgRlLkCVx mteNd+ZBwok430HRSEwPRZMeHH3YreN9/EHTsxSvLrV2vIoT/d9LYXuhJkDUdAeYnXgG /bRAoyMho0ih6qz8ocpeODulmzzJox0CggUzAsWJiJJ/LwC2Wnq1rE3GiLO4ISVlL+9+ xIS3e0StNJKlBDAf4FQNrWnhXvLME8pnzF1/aq061hQc19Zakf2snnbzftIQuznuoadt 7mRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icMFOnKs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si18734605otq.40.2019.12.29.11.35.30; Sun, 29 Dec 2019 11:35:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icMFOnKs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728936AbfL2RaQ (ORCPT + 99 others); Sun, 29 Dec 2019 12:30:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:55764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728191AbfL2RaI (ORCPT ); Sun, 29 Dec 2019 12:30:08 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DCA73207FF; Sun, 29 Dec 2019 17:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640608; bh=XULRCn4MQfOMAG3MTAgULKQzrpC210gPhhJ7gGFrWks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icMFOnKsNOoV6blMkOIa4OctgLAcytzQSNF1k62pzy7kSFa1pylSlGDn0/H1QT5GL GTunVv01SDdAl+RaCjDhhdraYkel042vyUJR0xB0736oVvxWhrI4xZQ3rJsFkAqXtv XhOZrcvJyxyuCrM4AhYk6qymzj55f642AmEze11A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benoit Parrot , Tomi Valkeinen , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 065/219] media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format Date: Sun, 29 Dec 2019 18:17:47 +0100 Message-Id: <20191229162516.443038902@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benoit Parrot [ Upstream commit 06bec72b250b2cb3ba96fa45c2b8e0fb83745517 ] v4l2-compliance warns with this message: warn: v4l2-test-formats.cpp(717): \ TRY_FMT cannot handle an invalid pixelformat. warn: v4l2-test-formats.cpp(718): \ This may or may not be a problem. For more information see: warn: v4l2-test-formats.cpp(719): \ http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html ... test VIDIOC_TRY_FMT: FAIL We need to make sure that the returns a valid pixel format in all instance. Based on the v4l2 framework convention drivers must return a valid pixel format when the requested pixel format is either invalid or not supported. Signed-off-by: Benoit Parrot Reviewed-by: Tomi Valkeinen Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/ti-vpe/vpe.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 69c0e14cccb1..76d699e94b00 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -352,20 +352,25 @@ enum { }; /* find our format description corresponding to the passed v4l2_format */ -static struct vpe_fmt *find_format(struct v4l2_format *f) +static struct vpe_fmt *__find_format(u32 fourcc) { struct vpe_fmt *fmt; unsigned int k; for (k = 0; k < ARRAY_SIZE(vpe_formats); k++) { fmt = &vpe_formats[k]; - if (fmt->fourcc == f->fmt.pix.pixelformat) + if (fmt->fourcc == fourcc) return fmt; } return NULL; } +static struct vpe_fmt *find_format(struct v4l2_format *f) +{ + return __find_format(f->fmt.pix.pixelformat); +} + /* * there is one vpe_dev structure in the driver, it is shared by * all instances. @@ -1591,9 +1596,9 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, unsigned int stride = 0; if (!fmt || !(fmt->types & type)) { - vpe_err(ctx->dev, "Fourcc format (0x%08x) invalid.\n", + vpe_dbg(ctx->dev, "Fourcc format (0x%08x) invalid.\n", pix->pixelformat); - return -EINVAL; + fmt = __find_format(V4L2_PIX_FMT_YUYV); } if (pix->field != V4L2_FIELD_NONE && pix->field != V4L2_FIELD_ALTERNATE -- 2.20.1