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: 12735031 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 54550C433EF for ; Fri, 4 Feb 2022 12:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358659AbiBDMPn (ORCPT ); Fri, 4 Feb 2022 07:15:43 -0500 Received: from mx1.tq-group.com ([93.104.207.81]:57007 "EHLO mx1.tq-group.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238672AbiBDMPe (ORCPT ); Fri, 4 Feb 2022 07:15:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643976934; x=1675512934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w/GuNznqndIUcAdDbJ2FxtN8SD25HIguOxBaARlAb1E=; b=ETZatjqwt/qlZvhTaY3bT2RVIvrFY6KeTMWp6aU1kDDQCBHjKpY+/eGS FFcf3fO6F94jDk4HJix2ZukOzoZ2EEIaA+39MaqH/ahiUMtVMxyLMtAAR HfiswdJ9qt555Umf8cZpVIoiYlwLwVkgXcdlPSm689DpvPeO9xqIyHFB/ +Ad7Fv/crexWMsY88cy/716A2BlugsqMZ2OYnLA6XemnsvcT0EWhPZjYU JQuO9RhZtOvfGBeErZ34Xo85YxkkfKC4qhq7GM8hUU0Q9Bi91bUKNJJh6 yn5YEyclHoeofzSldBTELONAUf/fyfM8SPTMXy+PkRsb/Ps4OqIFX4QiL Q==; 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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);