From patchwork Fri Feb 4 12:15:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735021 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 9BD6FC433EF for ; Fri, 4 Feb 2022 12:18:07 +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=k4JPKM5lepT+j/gA8DW3PDt0OYv6hhpl8oL30Sgdjms=; b=DNe9vyviAl+cFx vrumAl6kA7XUPZ7eViCwTgtiboMxUu6fLKmsegYniDj1deE3lfDG5Qov5yn1mOzuy/sYA58Rnxxgz 390d4iRG/SrQaGGDZyKC1lhqNNxmjploeNO8fe44Cj4SgLy7NNyu7Q/T/ByEV11I8uYALLAudnvQG K8UbAnfFZCY0Fp0BPP/e0X+s/JX9ZEXdkoRxO6s17Z4dWk2wKWi+73dP525acG/N+eY/9SSO1/7TN 8BLqqi6p8EVdJECPIYK6je4W/Oyw5vMSreEgOEeuoXtsyMIIDXo4b+fq5GTSDXBgkX2gXGYg34TP/ NwLDcoNs9E+utJ0zcksA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxW5-004DD5-UU; Fri, 04 Feb 2022 12:16:42 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxV1-004CcR-14 for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:37 +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=1643976935; x=1675512935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w/GuNznqndIUcAdDbJ2FxtN8SD25HIguOxBaARlAb1E=; b=QppNZkqk9tPaH39bRYActViZ1L+tg2fgH8oXBzTqUFcp07FIK5gFRP57 egG2NcIJNWxUPNwrggG2cyJCr+cMyqz+mLdtD0RCjf5W4pt2KHxLrEjVA hVhourPdFmNhYlxiDSYEyEm1cIz3zj/dD9ygbWSBKZN60Z8qgjUr6czxS 720QYK92/GZBRkz+Jzz5B9mns+4g+5KrqnQ32eO/uD5rc4AgEEguf1nCn a6m7XoLANvc51eeRSO/PYXojSlU13gVFyRviHlKDta7kLKKfHkmZ8rgZ/ oVNT0Z3Q1Fr/n75KpRxYthRncmI6KBRcC99w1CSaA7C4/ovYggRYZMg14 A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903443" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:30 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:30 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:30 +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=1643976930; x=1675512930; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w/GuNznqndIUcAdDbJ2FxtN8SD25HIguOxBaARlAb1E=; b=CvwyRAB+K8AiIManazXd7kpO5CcK37/S9oqyR8ayntBF4BeHtHhiOW40 El4mYVm2ttbqNLzcKBFyMjEamqX20DfD1HlikHdXJfygFiRlNjH/R0LRL wO74OboqI8YJKgYD8pOQhjDczptuvAB6t+2Ozy17Xa1kVO3/6RbjdoKPc WZ/NDjaT2KFqGDEdkDLNB8a/kBQm9Mu8clP+Dq5fwDxwpgrv2MSKY36Ho xoSjFpc5nW6B+PKMmxS9blBAlgjqfHXSbuyFaDWtCsQscVzeObkR/jTwP lPJvoxJ4+Y9DcYqUQ99Iytye+qc52ScavL3YVF5Ago3wGc1o8PkzlMOyt Q==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903430" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:25 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (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 43F63280065; Fri, 4 Feb 2022 13:15:25 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Stein Subject: [PATCH 4/8] media: imx: Fail conversion if pixel format not supported Date: Fri, 4 Feb 2022 13:15:10 +0100 Message-Id: <20220204121514.2762676-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041535_478173_8103A3D7 X-CRM114-Status: GOOD ( 13.39 ) 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 From: Dorota Czaplejewicz imx_media_find_mbus_format has NULL as a valid return value, therefore the caller should take it into account. Signed-off-by: Dorota Czaplejewicz Signed-off-by: Alexander Stein --- drivers/staging/media/imx/imx-media-utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 32aaa2e81bea..e0a256a08c3b 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -544,6 +544,9 @@ static int imx56_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, cc = imx_media_find_mbus_format(code, PIXFMT_SEL_YUV); } + if (!cc) + return -EINVAL; + /* Round up width for minimum burst size */ width = round_up(mbus->width, 8);