From patchwork Wed Dec 30 12:55:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 11993227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91E41C433E9 for ; Wed, 30 Dec 2020 12:57:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 664362226A for ; Wed, 30 Dec 2020 12:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbgL3M4t (ORCPT ); Wed, 30 Dec 2020 07:56:49 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:33746 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgL3M4t (ORCPT ); Wed, 30 Dec 2020 07:56:49 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id E78431C0B85; Wed, 30 Dec 2020 13:55:50 +0100 (CET) Date: Wed, 30 Dec 2020 13:55:50 +0100 From: Pavel Machek To: sakari.ailus@linux.intel.com, andy.shevchenko@gmail.com, laurent.pinchart@ideasonboard.com, mchehab+huawei@kernel.org, yong.zhi@intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: ipu3-cio2: Fix mbus_code processing in cio2_subdev_set_fmt() Message-ID: <20201230125550.GA14074@duo.ucw.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Loop was useless as it would always exit on the first iteration. Fix it with right condition. Signed-off-by: Pavel Machek (CIP) Fixes: a86cf9b29e8b ("media: ipu3-cio2: Validate mbus format in setting subdev format") index 36e354ecf71e..e8ea69d30bfd 100644 Tested-by: Laurent Pinchart Reviewed-by: Laurent Pinchart --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1269,7 +1269,7 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd, fmt->format.code = formats[0].mbus_code; for (i = 0; i < ARRAY_SIZE(formats); i++) { - if (formats[i].mbus_code == fmt->format.code) { + if (formats[i].mbus_code == mbus_code) { fmt->format.code = mbus_code; break; }