Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11814111pjo; Thu, 2 Jan 2020 14:44:50 -0800 (PST) X-Google-Smtp-Source: APXvYqy7x86lVu8F814/v7ZZGau8ngRk+5q061dccJv04o5EfPCyJMpW/qX5JZckIdG5MduF2DbK X-Received: by 2002:a9d:3f61:: with SMTP id m88mr76507171otc.56.1578005090222; Thu, 02 Jan 2020 14:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005090; cv=none; d=google.com; s=arc-20160816; b=Qo9TD9PG3H2ve53YmMuHEBJkjXIqLzTYbLiVahSJUkH6+FarUoDJez5Vpb50tDkDcp mpnwNNRDZti/C4gkv5RRWCqErHMDDClwpN923lF5GrWTus/DZhhOAjoAeGl7mZ28LnVb VkZiNusj32Tnc2alXQFYGL32RvPNSbBpURVWIHz+UOJQbldGM9mA9Z4SBNYT7NSCg3pU wNgD2K/4kyFp9Fjj4JNp4hdhhtOui90Ys2u+5h+wddzJw6n5l2WeSU8tdwyc86Aj2w7m NFeeF35CaBGZTFwd7cPXZdx5C3LbJ1MpFykQTCVqaWTSDy2/4y/BzMc7IJkkUUkQ3isz Mwgw== 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=8/6tgmyRK51MyQY4/fEry5RLjj797LieG93G2/f74as=; b=m6DzhH2CikbwRH28QnE5y3MRX//diYJuf7PmC9VNjogUieO2C8xQtDZkPHGJOcY84X XHGfW2RQRbuHrXF90JTZCtgqG0Idosc+rdh0v2pAsB/sZ3jjJbmL1z43XFWURnUCYY3H MawDjtKpn7GYLKsoMlOJN0IycqB8VG8bupYDklsDb5ZKubXARUNrt74tDzr1Wk14tgkr PZTU/j0tEa6Ihykkb20Gr3YNW70X5l2j9VNMyf4q3XOrE8vw5875maC71FD4ku9dqXYs K4YLNw0Xwl8mOar4WxeXkwPjLlfuoD97HCfF0BYSxsp7Q1Lm6KoJ6+oAbTOGrHblXTvT 5YMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OwCv7xg1; 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 s74si26738190oie.109.2020.01.02.14.44.38; Thu, 02 Jan 2020 14:44:50 -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=OwCv7xg1; 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 S1730554AbgABWeh (ORCPT + 99 others); Thu, 2 Jan 2020 17:34:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:43366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730247AbgABWef (ORCPT ); Thu, 2 Jan 2020 17:34:35 -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 20FA422525; Thu, 2 Jan 2020 22:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004475; bh=+5YuairaGG6kMU68ZaqLdhb0LRh4UtKhlg1Rwc//BzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwCv7xg1STwuM8FUnLJfh1wJB5XSrZmancgL/ipsLUI8+LLNlyzRj02hSTp3Tk49F 5uXyb+dEZk+FQKjCSN9gwr0ncu2rUiQo3TOb75uD2H0J3bKCG8vvT6/4fsiVR3Qz7b aQLp0+B/sg37Zb6Uf4fqLtm7fsc4MM/5ejqF6Zb8= 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.4 022/137] media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format Date: Thu, 2 Jan 2020 23:06:35 +0100 Message-Id: <20200102220549.639128370@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@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 de24effd984f..ca6629ccf82d 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -330,20 +330,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. @@ -1434,9 +1439,9 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, int i, depth, depth_bytes; 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