Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11818716pjo; Thu, 2 Jan 2020 14:50:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwDJtc8ss3u9BMaSzZFLzzDjehSMi4w+HYjhEEnCQi+FLIBwiwrH+Hv5pw6YCxSgFNmzxW7 X-Received: by 2002:a05:6830:4c2:: with SMTP id s2mr98227847otd.144.1578005403673; Thu, 02 Jan 2020 14:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005403; cv=none; d=google.com; s=arc-20160816; b=CHeSqdmF/ps+oh8cu9pHruZ7jGiKBdHsX74YFyS7XX3rv1gu0Yf95aQMNqUVdfPsln INGmZI/xi98h1/+8iIVC/KR6BKA+yyUZRTWfiPNd4uqZcTQk+CAHPgmPhbLrF+5Pu4v8 CLH6f1pqRRQABeElbG0XU/uN2Wgl2XM+pIYKsa7nJuiTbOq+WrJqWyXw2z8pUXSUnYRk 36uB7pI9kPTCdIgwOB3/+D+lfMMGm7Onoii/i8T75yQRKVUPRoCMdvKlRLsSVFFO+dAN Hff+NpoVFxVH+9Y0t0BjGNpJnM9eR/0l6Zsud8mJOpgH4uu7memFGYhI+svJ94vqSXPX qPYw== 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=AF8l6F933viMsSgjre8f3q4MjHl5GUrK5Elojz+hycY=; b=Th7ewQ7vxk6HJ/BNmWRAFirHHXctslT0ArfFByztytte0F4WjZZQ87QY+MSACh8/MC 3s9ocAbVHYAVeQrvt5Acm+TcR48s5ZnsMcdjWmUazzmcKb7MHN4xmHf3EwgMiSH1l/+1 TEP34KMFr+LiiDjoGUTV9hZcAK1DSUKySuDbYpUufysHRv2oSm4KbbeBGAvMRF0XPpcu iP9DJjtGE9fdg2O0DEcf6qedYUfZQsDPOTU89jEfZPS2XH/QtU7isOrDYzB50DSI+umg eexSWDGhMGrGcmKSxsHUI0Xr3tCRRt4U+3K4bv3ItkeHci/NNFOgRresqYrdgCZKq1/q iWVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mDXHouV3; 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 c5si25038940oig.75.2020.01.02.14.49.52; Thu, 02 Jan 2020 14:50:03 -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=mDXHouV3; 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 S1729817AbgABW17 (ORCPT + 99 others); Thu, 2 Jan 2020 17:27:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:57080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729804AbgABW15 (ORCPT ); Thu, 2 Jan 2020 17:27:57 -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 AB78020866; Thu, 2 Jan 2020 22:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004077; bh=FXLWGfb+mUAqSMXTCRBzIGJizba0Ms/m50Fos2BtZL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDXHouV3d+iUU+TEWRypRKvp8hSLRMPOg1QN8fPpnbIvRHVV5/kwrtjMKPeMVVasU kNO/n3aTZIAMFqSPUSTN1DmEoMHC5QTJ0RgzoM2QmzAtrq3KlGaPQi4oWnTUqeEKJ3 vcc/GdjLjyPvZl6XEoSxzOzUGjNrLt/iYyvCCFOw= 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.9 028/171] media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format Date: Thu, 2 Jan 2020 23:05:59 +0100 Message-Id: <20200102220550.958914081@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@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 0189f7f7cb03..da308fa6561f 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. @@ -1433,9 +1438,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