From patchwork Fri Feb 11 14:27:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12743497 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 158EFC433F5 for ; Fri, 11 Feb 2022 14:30:18 +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=cABRJ61o5wR11D3xF7QfXuQ1fVtJbTeDNa0RR4GCyCg=; b=gmPfMN17eYvUgm SzXI3LhqptDX8myoxLDP/bYQEBvb+4rGG78wXMd9AnybBuya4k3Vy8fHG6EgMkTMpD68tZM0g9YCy O4RscAs0KJhHeSe6IDu8oI7u+m4zKpX1cpKhCSA9fP17KOPYIu7zhE4Xr/qPRhsHjnPPWE5QUxgPq xNCRMqYXk1mbR+AzvEWe3+75T3v1qnBjKMJJR0ZNKIChgJJ0PNnWbXmyZjS6sXrXj5u5vyp6qS2lX qF+J80JTX3DHSjAVmmvDAW4j9hvwrIbZY7SzeVvcvojH4X2QYl+Z+/MNOF3OIB76u+gdNYKDgRzOT pNB0LgPg6ekxzpGs5UmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIWuy-007Ynf-Na; Fri, 11 Feb 2022 14:29:00 +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 1nIWuA-007YNH-8W for linux-arm-kernel@lists.infradead.org; Fri, 11 Feb 2022 14:28:12 +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=1644589690; x=1676125690; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aoiu4X1Os6dkBo5T/cU9kfbetuAKCwJrerGoWnhH00M=; b=hA1pLSAc5zW5lozJA48yJnFOErJ0oRItjc1nVsc+UEPUODR+2kTHSHqu sOy+hAGkbZkrj+ev1B1xJbXHb/V/vzJcZ3Nv5hGYdXX6DlU3u171SL8RH +K9apmNSTt2g/CPShFwMkRUvVV+nyCWDe8hTk6m2tYZYPxBCNzHCApABE mtHKndXaIyNIH3CvnJ/PphRaNAfzmqORR1qf9KIDYk9TuC9d0n7Jewd0u 9X3vHvGl9St6ZilqGo6hF3jWLK/1AKSGmvdC8wkXqXH99riO7QcsggFR2 /AinTCzKi8/Gzz2AMqsmXTOK8FeM7yrSEZhJjvZgpjxg8PtAZwRNoHd0N A==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042285" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 11 Feb 2022 15:28:01 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 11 Feb 2022 15:28:01 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 11 Feb 2022 15:28:01 +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=1644589681; x=1676125681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aoiu4X1Os6dkBo5T/cU9kfbetuAKCwJrerGoWnhH00M=; b=i2yWXg8UJiXLjDb99uLa/91rNPSi+Gm7ZsYtDqqYq/LZgZGo23FYT+R2 rcZzirY6zgFXgFIetiOKH7w+E3uZ3Bw3Ap+dDkP++oe7uEhaKXmqgluQz blsmoGk46BFMqunveeolAPfL1vSW4gCL18K/Zpgn1gxXCsItUsLEQlF1K 0BhlrLAxej4Z+vkU5dFESKsDhSD0k7jZBAZtL90pEhzV9mhlAb34hdLCW 9EtHRSLsTW+8iznKQfaOTg3r8IsEtskX6Hrf9iiQstj0vwDn06JkNe6KQ XdsECeCIHPiBw81G34zD7trBsJ2Iu6GoQS4WxbdWIco1k7ooQLHwDDHg9 g==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042284" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 11 Feb 2022 15:28:01 +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 646D7280075; Fri, 11 Feb 2022 15:28:01 +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 v2 4/9] media: imx: Fail conversion if pixel format not supported Date: Fri, 11 Feb 2022 15:27:47 +0100 Message-Id: <20220211142752.779952-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> References: <20220211142752.779952-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-20220211_062810_693126_ECFC61A2 X-CRM114-Status: GOOD ( 13.93 ) 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 Reviewed-by: Laurent Pinchart --- 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 02a4cb124d37..e59aaa77172a 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);