From patchwork Tue Mar 21 07:27:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13182333 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 E0576C6FD1D for ; Tue, 21 Mar 2023 07:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbjCUH1U (ORCPT ); Tue, 21 Mar 2023 03:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbjCUH1S (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 3A84C33CD0 for ; Tue, 21 Mar 2023 00:27:16 -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=1679383636; x=1710919636; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o91knlkLKj3jVc/NrGbR0CpGKWa9jyYUipzes/AkaMw=; b=FrjnHQ3bkYRcG4FuyJcstuaI3Rc64GXpILItycfC0H9QveI3XN4393ZC SoqUo9Xj/SKnG6dFQZuLMb/eT8fv/NkQJttiBsg6CpyfSoJ/uEp6F4iUk YHr+bjBPCyAlDDB9UPfx0JmaPSy6GD0GdeXOi9g9vSu2qKun6Zg7ahblk 4UzV9gAq1vMeIrq3NHj4udELE2yLq4tYXW5p4AvYfUXZfFDidDSKBvtPf eKC/5cqNB26PhWsoFyPOjkkBLS7dcOFMNuombDEe07fgX1OrLR6QX+pEn W0SbnJKgL29Ly0xgLiAw1HC4rZu7wYB2M747OVxM2/QuTa/B2h9uCBEm+ Q==; X-IronPort-AV: E=Sophos;i="5.98,278,1673910000"; d="scan'208";a="29819255" 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=o91knlkLKj3jVc/NrGbR0CpGKWa9jyYUipzes/AkaMw=; b=ekKk470CNBQXkzO6EW0Nydqwb4YgYglRqb63K6aaXQGzybvlG4aXbm7K iSfuh8gy1f9gPzFvWZLbMUdh2755nI01x2RK6Ydu9mQkOaRLsepeu4cNA A/MHZqgqeBfX1TsKhyp60Q5/dtfj04YW3wunkbcf4Kl9qfzWo8+kRmNs6 WTTAHb0WOIJPE+BLJRAn8tLrZZ2LeQ/qgWgvTL+DAx2fKT7BVUyy2cQFK lBkkU/uSrJKnA3PYrSbqHEmqDdwBvCo0zfgpkAl6r+Y7QEEgOcws3K3Ml qjaWKqpHYfpp9YUK3vQ2OmtGC9sWKMxWgq8mvcXmlGCS0zQSxS5mbTEcp A==; X-IronPort-AV: E=Sophos;i="5.98,278,1673910000"; d="scan'208";a="29819254" 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 25D2F280072; 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 1/2] media: imx: imx7-media-csi: Fix mbus framefmt field init Date: Tue, 21 Mar 2023 08:27:06 +0100 Message-Id: <20230321072707.678039-2-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 'field' is zero-initialized to V4L2_FIELD_ANY, which is an invalid value to return to userspace. Instead fefault to non-interleaving. Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart Reviewed-by: Rui Miguel Silva --- 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 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: 13182334 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: