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: 12602933 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 725A9C433EF for ; Thu, 4 Nov 2021 11:46:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3A1826120D for ; Thu, 4 Nov 2021 11:46:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3A1826120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=puri.sm Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date:Reply-To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MBmvwbv0sVDztoI2YKPgP0yWaur1fJZXa3TQooY4RiA=; b=lYZTNg8XeGic1dj7gWGqhCpJ9I udDw0Nx35UKiPL0Y4PGkol/ykcHvlHI5oPkUDoXzm03FwmT/ZdDRILEV2HL8tf5iBSH13LQJVu2Y3 Nt/+yhQzTE0JcxRI+GTbs3IfsQ4aWa/naY7lM2mjIlmLfA6YNUxyWD/qBd/Lq6EbLLj0LvzntQkCw WEkHeikuO15UNVHkHhJH32G4Uzns6LEBxYw1XekEoXR0UTTv4vprxBM2xdy1iw77wx4n4w6LUWxBJ lIAt3vlW/I26kPmiC9V0QiOJaQXESr947CkMDoHrPY6AcKS4psfzo5Ifq9UK1FJ2otn2EfH+XiMjH 7oNn9sIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mibAs-008kNk-Nx; Thu, 04 Nov 2021 11:44:54 +0000 Received: from comms.puri.sm ([159.203.221.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mibAk-008kKR-S6 for linux-arm-kernel@lists.infradead.org; Thu, 04 Nov 2021 11:44:50 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211104_044446_948057_DA289925 X-CRM114-Status: GOOD ( 11.36 ) 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 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);