From patchwork Thu Mar 16 14:38:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13177754 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 E1BFBC6FD1F for ; Thu, 16 Mar 2023 14:39:36 +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=SIBSTF542Doh2/SI60vnEos5WcUH62nRx0Qu1RlUaIs=; b=W2W8faOiIZmvpy LMHPne+eOIyQxu3st1Jq8+RlnQDmDTZMVnnFM46bFOCSx7HzUj3pFEMPUmn7QQiMhAJliFwsLt08V m65bBMvwZ7W1O7X/P6UPiPUPCUibHCC21kbV06LycE02Wekeiq9RsTzQk/Kc4WA5os4Qv7eXiQq4T LxA9pwDJx7UwNW5LQiGwUWW8hNdopepjDldKfQqDYW3DDb8gIhI6ZsbvkoFaGS3mO8sx8n/T6Dq0G u45y9zCTg7v+5lLwFXLARbwiRr7Nfmkn/1QCUan9rNTUbJ7YR0yKs0sQoZVnnfVjf61jITW71njMn mMRq4ifHtXyYFA/JGILw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcokg-00Gi3Z-02; Thu, 16 Mar 2023 14:38:46 +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 1pcokY-00Gi0e-2x for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2023 14:38:40 +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=1678977518; x=1710513518; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mhnoEpspCtJRJReAh29qeaQUkE4Nu/+7CyEHyKvOT98=; b=dQVrXFLP3f1z8H6as14/McKPlNr1Namq9HW4xgIEIPuEk0EsS7dzgmm3 UQlALaA0y5G7Mdb77zmzUWwTHB9BIYKmYEpU/UFbI7WPeza8WEZ2JXEUP /AIr7Ke11dqZSRMwBAdQuknfnEqOR4WMGFG8JVXvbYsEq2ExtO7XnVDrE koKgxj/M3aXjIaM58UsyWluUh/GlGDtuWOrgM8g9pke69IOZwn6pnEea6 EjhqkvGMhiRbGzEGh4LXobCklRUBFHmisDxPyrXC/VZEQ/lDC6DLkXy+k +tuezVKBSzmfsXDz1A01krbPkfayPkLr5QbtV8l4bQSzyJCmA8tT/N1Qm w==; X-IronPort-AV: E=Sophos;i="5.98,265,1673910000"; d="scan'208";a="29742384" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 16 Mar 2023 15:38:34 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 16 Mar 2023 15:38:34 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 16 Mar 2023 15:38:34 +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=1678977514; x=1710513514; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mhnoEpspCtJRJReAh29qeaQUkE4Nu/+7CyEHyKvOT98=; b=Cfhz6xRaNwACAPhxdW3XImGE23HUC8sW3L4ry24QxMHB8dyMVTeG3mwc o5cq3FtLJuvm8VaogbhqsJrlgZj4WeOOpoNvYHF/b17POJKSmoByPop/m gMGmUtzkwM40PAG/Nj/CBGtoIqC/OTWGXGXqeeSKJLnqdyn/bmGfMIOqY d+cpeuqNWc3qlqCBBI2HsAgZ1C95oZEsJdD4MxrR1ztQb8gaPDC+VTTUF mSkAb7AnuFRVU+nqeMCJ/qOXdBynVDsnB2dcGIzSJErUVabpOBs0sQXLw lQ+3jTO4qeI8hQldYBCYY+yl+Xn/XYFrLNQdUtpte5ycRSj3enMPOhv04 g==; X-IronPort-AV: E=Sophos;i="5.98,265,1673910000"; d="scan'208";a="29742383" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 16 Mar 2023 15:38:34 +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 2B21A280072; Thu, 16 Mar 2023 15:38:34 +0100 (CET) From: Alexander Stein To: Rui Miguel Silva , Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: Alexander Stein , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init Date: Thu, 16 Mar 2023 15:38:27 +0100 Message-Id: <20230316143829.499039-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230316143829.499039-1-alexander.stein@ew.tq-group.com> References: <20230316143829.499039-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-20230316_073839_255384_61B08CE9 X-CRM114-Status: GOOD ( 10.22 ) 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 Default to non-interleaving. Fixes: bc0d3df31ffe ("media: imx: imx7-media-csi: Simplify imx7_csi_video_init_format()") Signed-off-by: Alexander Stein --- drivers/media/platform/nxp/imx7-media-csi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index c22bf5c827e7..3e97b9f2ff69 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1610,6 +1610,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi) format.code = IMX7_CSI_DEF_MBUS_CODE; format.width = IMX7_CSI_DEF_PIX_WIDTH; format.height = IMX7_CSI_DEF_PIX_HEIGHT; + format.field = V4L2_FIELD_NONE; imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL); csi->vdev_compose.width = format.width; From patchwork Thu Mar 16 14:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13177751 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 668E5C6FD1F for ; Thu, 16 Mar 2023 14:39:33 +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=ljSPBVb48TsEI9Brvl/kqIyuibioJh28YB8uYzg6k1g=; b=VMDwporAAQyuiv WsZsQ1s0DGwJt98n70yUkLi+XXS3pMXwz2HBe1eC6En2iTp095+XBqJuzZI1TFKttu1zNNR1SgSm6 MrcHBgWnvZ7P6IwdkSKb0VAMGpS9OVFryDjQBkevy6t0IKk9t2yjTcbOHUF4xHpr+/cNdosCC18Kj gy0IQRRFVViMDyeIollsdqQn/VQP3XRtqIhDwG4FyKKP47XjBK4EvkD1nJpDc99JgYUcII8c0Wmng KTIlV0PrfivRA8odZxwcivie/UGlmOl7c5U0Ce8G4Ggoijm55Rd/AcLY2E5jUIXLOMS4QFlNjU2gI vUFRiL3eFNY6OTf4lcIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcokh-00Gi47-0B; Thu, 16 Mar 2023 14:38:47 +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 1pcoka-00Gi1L-0a for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2023 14:38:41 +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=1678977520; x=1710513520; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bLu9zhi97wGXbZiCwmF/Y8gYg8cqIwM7tO7VNBtzc58=; b=ffhEtZCtMXK9ErDBCNDA6J2SIFCi5Gtc5LFHzQZ3OdAm212mnoD5LP5B nRuNFBGLpYXINoHPqqdKgAvz892YUV1JwjDBL4rfSyP7voDpVXUjyA+6d hH0lD1/OuncLm1a/iKybJyjy438E8ZipBOWEWeDKe1wj9s1Qo4vgPh2OT m1BslCRJ/Kc51saS/+unNI2pzwp0tTtKTLePKmH460ddd21pups291oNS VxGJG4Ag8RSJASiE6Dco9twVYpM4eugPFlkFU3ze1Y4RROW21Dyi2J4EI u+OfVrQKeKiuRMbILdWEhvJgMP0ALd6lzR7K6NGVZNQREUx3leEBtZ8p+ w==; X-IronPort-AV: E=Sophos;i="5.98,265,1673910000"; d="scan'208";a="29742386" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 16 Mar 2023 15:38:34 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 16 Mar 2023 15:38:34 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 16 Mar 2023 15:38:34 +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=1678977514; x=1710513514; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bLu9zhi97wGXbZiCwmF/Y8gYg8cqIwM7tO7VNBtzc58=; b=kOK/ayRFK4xMscGxe69eVTU7Ww2dpmFnqGYUruGjRn+NGM1GTX0ltgMY 2SjYSItgfJ/t9iNX+VqzcMoz24BvJk0ByKVymmWLjfmGF90Pe07/9Bx7v wnQ7voSlx5PgA/gWri/XlZp07SoAHqN2ck3Oy/wJnm581Vm76+s9wGOUz NfWmj26Lo25Mldd9DUey9bMVZSsFkN2X/osd1dqzRLTVyN/s0wIDEPcqr 9vL/r/eIkp18p1hqP4JLIGHYGnk8Kr0AAKhCclEk+naUyTjFqlbZjTzsO U3VD8z5zCO1rm3ntCjPN3wqk4iu3PWTSyNdLJVOWAA82McHWDJdet+Nh4 w==; X-IronPort-AV: E=Sophos;i="5.98,265,1673910000"; d="scan'208";a="29742385" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 16 Mar 2023 15:38:34 +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 638E1280056; Thu, 16 Mar 2023 15:38:34 +0100 (CET) From: Alexander Stein To: Rui Miguel Silva , Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: Alexander Stein , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION Date: Thu, 16 Mar 2023 15:38:28 +0100 Message-Id: <20230316143829.499039-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230316143829.499039-1-alexander.stein@ew.tq-group.com> References: <20230316143829.499039-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-20230316_073840_530710_B01FBFBF X-CRM114-Status: GOOD ( 11.75 ) 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: From patchwork Thu Mar 16 14:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13177752 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 10A21C6FD19 for ; Thu, 16 Mar 2023 14:39:34 +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=e+k93sB+yipkVcL+T+3kbGq52mSL6bZFpvMPfaDZk2Y=; b=vWBbGo69vpZesW iwXgnEg9I1LCm0L2X0bHizADUTj8dMjR/8vWxXZ+aPQ5jFUzJaEdoQ3uCSMujbW4G5MjEIwmfzRqX N2sCnqGuLQlMef/HB3XWB64Rps2hhGNPi8HMpGsQUK3H49G5plKtvFAHtFUar7rtcKZRE6cxvyy1a tx8JJV2bPfcBnjv0AYsPV6SmNogAGICtEKtEwGBO7WMENrpcLZ4U+2Aco0jz0CaCB1t/YFHD7S/p1 WnPJ4sS4OrXf5rRDqaFqSuUXFXmB+3TmBG2qOelNI2hqcZzjzBrNvkxGOLKuqzx+7bj+nxihrzAUY eMBNaX5DhDN8OINAWtUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcoki-00Gi4s-0X; Thu, 16 Mar 2023 14:38:48 +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 1pcoka-00Gi0e-34 for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2023 14:38:42 +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=1678977521; x=1710513521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C9sNIEVpGd0LWVqABddnM3tNj1tR5BNHnL7rTZOVfhY=; b=mMzjt914m5tyhJKgXpO5sBFUVF3NB0oZx4JQbXUcd4l4XMwrbfAl7JeI Ij0Xr0b5GfYnF/IRP2GFw7a0SLPSSjgF79fDEfoDPuiebonO7fye2Zf5Z 5C9QFdremSUaObcKRIccd+YN/HqlIP59xa9zMWf324wChOIUiD5O5fCAT ASQD/BRA1kU+7Gj64zCZ6ygD9gXpDvv1txueL8CpTV4l+3KA36qupADez yRQTMk2RwphKm1MDkxULvbKg7BdJ172WxU5BXtoA82Orx4Ej5uokej4/N M8v5k52Rft8PODCSwLjtb50MGB8RGwpX/5RRuea0bY67Vq8FgKZAypyLD A==; X-IronPort-AV: E=Sophos;i="5.98,265,1673910000"; d="scan'208";a="29742389" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 16 Mar 2023 15:38:34 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 16 Mar 2023 15:38:35 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 16 Mar 2023 15:38:35 +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=1678977515; x=1710513515; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C9sNIEVpGd0LWVqABddnM3tNj1tR5BNHnL7rTZOVfhY=; b=GzjEgpHWDfnYv9oWF4xkwJTgyDvlf1EiT6g6QHwaY8w9eIdOXlcAxuXZ zTuAs2ba3qVoAMXFnE1FozAqZYTS8+Ja/625NpBIsFNSumqCsiYqVbvYH zicn+p+STz2kfwFPL5owR5dTf2n9k8Nu5vi5wRl2ueW7NEBQ5DCA05W6r KE2MWdEvzMl8K5ubw5YfrkbQAxg00KSfpJSPhUYGLB05tbigkXCi3Aqfi CgsNin24Lh80dOPwolaIawrmeqPxfjitdRQKVWu+GLY4w0PjrKQbTlE43 PacJoaKYoKatGvUNvLe53S52iG8jfQNjdjOa7Z1uW4xXZBHcNlCCHDhVR g==; X-IronPort-AV: E=Sophos;i="5.98,265,1673910000"; d="scan'208";a="29742387" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 16 Mar 2023 15:38:34 +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 9C9C0280072; Thu, 16 Mar 2023 15:38:34 +0100 (CET) From: Alexander Stein To: Rui Miguel Silva , Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: Alexander Stein , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats Date: Thu, 16 Mar 2023 15:38:29 +0100 Message-Id: <20230316143829.499039-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230316143829.499039-1-alexander.stein@ew.tq-group.com> References: <20230316143829.499039-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-20230316_073841_347503_9963B175 X-CRM114-Status: GOOD ( 12.42 ) 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 driver only support V4L2_BUF_TYPE_VIDEO_CAPTURE, so fail for other passed types. Signed-off-by: Alexander Stein --- drivers/media/platform/nxp/imx7-media-csi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 389d7d88b341..e470b0505d3b 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1186,6 +1186,11 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, static int imx7_csi_video_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) { + struct imx7_csi *csi = video_drvdata(file); + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + __imx7_csi_video_try_fmt(&f->fmt.pix, NULL); return 0; } @@ -1196,6 +1201,9 @@ static int imx7_csi_video_s_fmt_vid_cap(struct file *file, void *fh, struct imx7_csi *csi = video_drvdata(file); const struct imx7_csi_pixfmt *cc; + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (vb2_is_busy(&csi->q)) { dev_err(csi->dev, "%s queue busy\n", __func__); return -EBUSY;