Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2721927ybi; Mon, 17 Jun 2019 09:31:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTG96hUoBJ2BTo0U0Pl+EM9Kz5zjrIeR0Jtv8ji4o466J3A6r+yr5Yejj6yqgv9N3eekfe X-Received: by 2002:a62:5c84:: with SMTP id q126mr88093826pfb.247.1560789078892; Mon, 17 Jun 2019 09:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560789078; cv=none; d=google.com; s=arc-20160816; b=H0rNP0ISn6Cwi/+tTeQLH9A3ERRFoXnP5Fp4y6v+ijZ0Ghf87v+7iVMgwiXsHYa8G4 dxWzrg51tJrYbM2PfYgoyB6093xVbH0l/G7ZI+xnOeOP91Qbj6B+T7FoThvJkDaqGro6 lorcpGav5D4TjVB5hKd831etzyFqTuROmzvU+pJkWkirjglHPaJXCR5X0OoC/RdFGzR3 IRt/6G+tRNh+s+TuIgfVmFs1PQ1lCOJFe/cY+WCLuWGiDP5nsUnr77lj4mYQWy3EG0E3 pNARqrHcYkyGzsgU74+IhLUH/owFvzie05205plIFvARf8hH7FjFOXU5krnY7bh3fzDw oXQg== 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 :message-id:date:subject:cc:to:from; bh=QUJyOSygoH3UiN/a5QpXHSm4Abqd/KbGouU8G9QzQZg=; b=SaL04ElkkEfnfY0DGVMv1vAC6rqlWmXzdC1xjffdWNTWDfD5fKcShNo3me2dXRiDTH ZQIVxyqNyfH+Sx+NKqAOHVev3HTEr3eEE7mWFNKJMn1oo+mVWEa0l8woelt4MECfmSpI LOm67c7tQYUyCoSwQpSYRNJvZL6PbaViWFF8onAg2NfQ2pxQZ5nrKNFiSpkppcWJyedy A5KKCLASuYJZRmYgeamtdPcoclWLgkgco2O1u4Jj9MCR2QX/PQ6u87I3skIT9yL8zON4 DIXY+5+sKJ0TJD/9VSsycekB+PRo1XTUpn+bmVGHl/DKm8MEAwgeriffLFRb/uppFl5Z cZog== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si10961502plx.200.2019.06.17.09.31.03; Mon, 17 Jun 2019 09:31:18 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbfFQQ3S (ORCPT + 99 others); Mon, 17 Jun 2019 12:29:18 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:55100 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbfFQQ3R (ORCPT ); Mon, 17 Jun 2019 12:29:17 -0400 Received: from turingmachine.home (unknown [IPv6:2804:431:d719:ae74:d711:794d:1c68:5ed3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tonyk) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 031F626D0BB; Mon, 17 Jun 2019 17:29:13 +0100 (BST) From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, hverkuil@xs4all.nl, helen.koike@collabora.com, kernel@collabora.com, linux-kernel@vger.kernel.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH] media: vimc: cap: check v4l2_fill_pixfmt return value Date: Mon, 17 Jun 2019 13:28:02 -0300 Message-Id: <20190617162802.10042-1-andrealmeid@collabora.com> X-Mailer: git-send-email 2.22.0 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 v4l2_fill_pixfmt() returns -EINVAL if the pixelformat used as parameter is invalid or if the user is trying to use a multiplanar format with the singleplanar API. Currently, the vimc_cap_try_fmt_vid_cap() returns such value, but vimc_cap_s_fmt_vid_cap() is ignoring it. Fix that and returns an error value if vimc_cap_try_fmt_vid_cap() has failed. Signed-off-by: André Almeida Suggested-by: Helen Koike --- Hello, This commit was suggest by Helen at "[v3,05/14] media: vimc: cap: refactor singleplanar as a subset of multiplanar" drivers/media/platform/vimc/vimc-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index 946dc0908566..664855708fdf 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -142,12 +142,15 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct vimc_cap_device *vcap = video_drvdata(file); + int ret; /* Do not change the format while stream is on */ if (vb2_is_busy(&vcap->queue)) return -EBUSY; - vimc_cap_try_fmt_vid_cap(file, priv, f); + ret = vimc_cap_try_fmt_vid_cap(file, priv, f); + if (ret) + return ret; dev_dbg(vcap->dev, "%s: format update: " "old:%dx%d (0x%x, %d, %d, %d, %d) " -- 2.22.0