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: 665737 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BF4C7618D for ; Tue, 21 Mar 2023 07:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229902AbjCUH1V (ORCPT ); Tue, 21 Mar 2023 03:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjCUH1S (ORCPT ); Tue, 21 Mar 2023 03:27:18 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 716E33253B for ; Tue, 21 Mar 2023 00:27:17 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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: