From patchwork Thu Nov 4 11:43:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dorota Czaplejewicz X-Patchwork-Id: 12602943 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E39FC433F5 for ; Thu, 4 Nov 2021 11:44:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1928761205 for ; Thu, 4 Nov 2021 11:44:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231487AbhKDLrZ (ORCPT ); Thu, 4 Nov 2021 07:47:25 -0400 Received: from comms.puri.sm ([159.203.221.185]:37190 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbhKDLrY (ORCPT ); Thu, 4 Nov 2021 07:47:24 -0400 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id A868ADFE44; Thu, 4 Nov 2021 04:44:16 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LAqdrt1XkV3F; Thu, 4 Nov 2021 04:44:16 -0700 (PDT) Date: Thu, 4 Nov 2021 12:43:58 +0100 From: Dorota Czaplejewicz To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@puri.sm, phone-devel@vger.kernel.org Subject: [PATCH v4 5/5] media: imx: Fail conversion if pixel format not supported Message-ID: <20211104113631.206899-5-dorota.czaplejewicz@puri.sm> In-Reply-To: <20211104113631.206899-1-dorota.czaplejewicz@puri.sm> References: <20211104113631.206899-1-dorota.czaplejewicz@puri.sm> Organization: Purism MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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 c0a84c79947e..8646f6ba1108 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);