From patchwork Thu Apr 16 13:21:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 227695 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 4A995C2BB55 for ; Thu, 16 Apr 2020 15:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 277CF206D9 for ; Thu, 16 Apr 2020 15:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587049545; bh=UNXYY5nHx1oKv7D1DvC75seHCoQHrTodEf3J7c6UTf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ewftf0SzS27TFAf2hfSbcjp/M8NYMsNqabP7I4lrGBSfbgyNyBhfDqe1/Geqtj1uf lfcdEAMs+H+7CMPjqwxwGaGWkfPiL/vy7VTTiNTftQbXn3NC3jiiPAlpzXrkpuEa4e jSzKwNByKJ3DXuD3VYLtJRelxTFuIDzDRlltIwAA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438369AbgDPPFk (ORCPT ); Thu, 16 Apr 2020 11:05:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:38820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439055AbgDPNwb (ORCPT ); Thu, 16 Apr 2020 09:52:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 815EB2063A; Thu, 16 Apr 2020 13:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587045149; bh=UNXYY5nHx1oKv7D1DvC75seHCoQHrTodEf3J7c6UTf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lS9dSr/b/i3J2vgmC3K32V0RnmWRltsBBnWgI0uHtA0n7z13KZSEMTx+VRsqPVDzd 1lyet9dEbkWZlAzzi+QzRGA+tPFFG8Oybp3VbfyQg65EANHD/9zMGreWSGNxMUIZf2 CMdvZ2aFRHBk1AVa8C6wWzk1f2MhDcrulnriB7wA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wojciech Zabolotny , Helen Koike , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.6 009/254] media: staging: rkisp1: isp: do not set invalid mbus code for pad Date: Thu, 16 Apr 2020 15:21:38 +0200 Message-Id: <20200416131326.924635898@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131325.804095985@linuxfoundation.org> References: <20200416131325.804095985@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Helen Koike [ Upstream commit 100f720aabab3d5f58f67c508186041b3c797a9b ] When setting source pad, check if the given mbus code is indeed valid for source pad, if not, then set the default code. Same for sink pad. Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") Reported-by: Wojciech Zabolotny Signed-off-by: Helen Koike Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/rkisp1/rkisp1-isp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-isp.c b/drivers/staging/media/rkisp1/rkisp1-isp.c index 328c7ea609717..db892620a5675 100644 --- a/drivers/staging/media/rkisp1/rkisp1-isp.c +++ b/drivers/staging/media/rkisp1/rkisp1-isp.c @@ -683,7 +683,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, src_fmt->code = format->code; mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); - if (!mbus_info) { + if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SRC)) { src_fmt->code = RKISP1_DEF_SRC_PAD_FMT; mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); } @@ -767,7 +767,7 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp, which); sink_fmt->code = format->code; mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); - if (!mbus_info) { + if (!mbus_info || !(mbus_info->direction & RKISP1_DIR_SINK)) { sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT; mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); }