From patchwork Tue Mar 21 07:27:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13182336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C91B3C74A5B for ; Tue, 21 Mar 2023 07:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3pzy2Vh+jQQcwXr0RX84nyK7q1l5cDQkBu11XD86sV8=; b=pz24IMA8YeWZbr KOFRdZ8RZbdv1yGz/tV6vj2Uxz6OQbGlTIq76+s+YkgnePHAoceOzC0BNzCNhNtSBeVjUJwj6iRDH T0pNE4ko5uDL2L2Jxu6x3d/CvY/hUBTntaQaN7Kjy66A6rc75D62FofgHaYo4xP+99sATU2Irm5iU a0iT0lgqUn3nCkDQPqvCpRdwHnRjcoZs6lL0hoigQu/uLXFOvvibxYPPqwOapelkruRd2Xou1agPf EIrFSUrNDp0DIkrm4gEBwPXSnLWry7Jgi4vn9X5N9G11of0fAzY4JyurDuc3So96cDIyc0Ec12XOh xk8ZH+d97hfTvbCSIxUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peWOy-00BWbg-1f; Tue, 21 Mar 2023 07:27:24 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peWOr-00BWY6-2q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 07:27:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1679383637; x=1710919637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EfdX/9qiFzppnd+Vz21frBaqbACvZB7/0EYonfhtuWo=; b=oPdx9peDPOdTDWTX7ycPGCjUMF14xH7YzOZYEkfGUEZIkZ52EdSuZoOq EP6Q98jNrcAC475/cp9J9sv9OSsZ0XNYr2X2LTmr4QEgLXB8OzlwRU8zw fgT2hLC03XdLA1psc99/55bl6RuJCJejjfjMFpFogehJJyn5m/qTL0/J+ GgYrdacdIFclZhBJp9wAPP0uUnP8fjq96Rv09Q0KPOcU0SRJycMPKVFnR FVGvhLF4csYhdAUDika1sv/LaihHOeFyE9R+JK+EMAxxzgDAQah+W37+m KgPJyJgcXpkUXHYOUfd2pHm1L9T5jKaL+yxCPKZxvC4cITFNzbVoRuEpf A==; X-IronPort-AV: E=Sophos;i="5.98,278,1673910000"; d="scan'208";a="29819257" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 21 Mar 2023 08:27:11 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 21 Mar 2023 08:27:11 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 21 Mar 2023 08:27:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1679383631; x=1710919631; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EfdX/9qiFzppnd+Vz21frBaqbACvZB7/0EYonfhtuWo=; b=BTxlMn+trD/QahqJMJoa5xP32caFTcbbU+gSC29tNVTvVm//Q8lMgzrd fCMyMNh0Fn8MH7PtwtRMIPq/FOZdE3IS8/PtSRrNBoCFjTtVfsSSQB+Se n/Wqa779hZOH88/jXEYXPrsxjRAYptikvXHGnwSrFI1XXocXgDl0BLnnS NrOQBzrv0JfRSGolIFJpBD8cNJN4E0tdLra/Lx2xENTGIYUcJ68/KmJYL 5al5RCojchucj21VvkVmnQVFuRkVgVlMa6i6jYHvb5GIUaSFnjBJf5UbQ 42cRmR7N1O+jm4qkmpuuDURxvOic33kctWmg8SUz88/MPvK05TS2ZG7Rm g==; X-IronPort-AV: E=Sophos;i="5.98,278,1673910000"; d="scan'208";a="29819256" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 21 Mar 2023 08:27:11 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 64F76280056; Tue, 21 Mar 2023 08:27:11 +0100 (CET) From: Alexander Stein To: Rui Miguel Silva , Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , Pengutronix Kernel Team , NXP Linux Team , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/2] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION Date: Tue, 21 Mar 2023 08:27:07 +0100 Message-Id: <20230321072707.678039-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230321072707.678039-1-alexander.stein@ew.tq-group.com> References: <20230321072707.678039-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_002718_239503_7EC9AE85 X-CRM114-Status: GOOD ( 12.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This device only supports video capture, so bail out if invalid selection type is passed. Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart Reviewed-by: Rui Miguel Silva --- drivers/media/platform/nxp/imx7-media-csi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 3e97b9f2ff69..389d7d88b341 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1214,6 +1214,9 @@ static int imx7_csi_video_g_selection(struct file *file, void *fh, { struct imx7_csi *csi = video_drvdata(file); + if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + switch (s->target) { case V4L2_SEL_TGT_COMPOSE: case V4L2_SEL_TGT_COMPOSE_DEFAULT: