Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2010767ybv; Thu, 6 Feb 2020 14:09:01 -0800 (PST) X-Google-Smtp-Source: APXvYqzm3aE7eg+YHuZcVG6wyFuG0uIbMzB/aNBbsT6iGBXRcHpxJEI/xw9lb9RXcXJ75w9xgs8H X-Received: by 2002:aca:c08b:: with SMTP id q133mr80601oif.46.1581026941473; Thu, 06 Feb 2020 14:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581026941; cv=none; d=google.com; s=arc-20160816; b=qOtYyLnuzlZEvv27bv52Rkz8n4yuvH57tev+UCgOb0BNGZ35rvL8AWzrqGHUrI2d/c dBQpqBGPRR7ntZJvhvl305i/w/gxygi/cMvddeBPDew2YitjiW3UJh6xKpeiaqCyvCL2 BsazOnROaP6FsVmJ3lN/qUi6Tg+ar6dkeJxSYOfZQUlbKU96pWm0fkjRA6lxasp56b/M A5orc88bfLqRHT10f78hO64L8EKARgHM78fsbOLBwVKKEpzic+4vEhFywa9In5q4rrwF P+AYr2UmCwJxZwAvfNdGHQq5TszH/ELgFrIxpzUWatHzFvUrB7pf1o9kMgXeU0rXkONe Ywxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2a+cqpt4ttPt9OAmk7UlRNAJDi5ofDAzHcfUsL9q3Dc=; b=w+4h6DPePBMbet0xh+w6fTagOhyRth0SqLvCn8g9mdKk4EBsz6DlwjSc94l7fMBpcg nRvg7M6HFNEjqWj/626frHaSpSZOBjCpVe2oMcz2nvR2n13MuN4E8lFCSB1IugS3veov RE+hI6Xa08yi5A6bk9R6y1ZarL7ZaWxQO0/YmaAn/fKXXSv4tlkZ7Zud0pJLuS5d0FWF WXLA/D5obBQ75UI8WRnncmynE2Kln33wbZUwlnuJQj8ApwMjWFWDhqHuuWUHg8YRHORJ fm27rLuhT+1B19EZYhJFF67WAk9wH8RXrhYOOZXsAXyfd/0m1moPaOIfM4TuTMVM80Up fsQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si462681oth.247.2020.02.06.14.08.48; Thu, 06 Feb 2020 14:09:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727873AbgBFWHh (ORCPT + 99 others); Thu, 6 Feb 2020 17:07:37 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:45056 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727675AbgBFWHg (ORCPT ); Thu, 6 Feb 2020 17:07:36 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 2755D294A4B From: Helen Koike To: linux-media@vger.kernel.org Cc: dafna.hirschfeld@collabora.com, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, mchehab@kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Helen Koike , Wojciech Zabolotny Subject: [PATCH] media: staging: rkisp1: isp: do not set invalid mbus code for pad Date: Thu, 6 Feb 2020 19:07:12 -0300 Message-Id: <20200206220712.1243438-5-helen.koike@collabora.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200206220712.1243438-1-helen.koike@collabora.com> References: <20200206220712.1243438-1-helen.koike@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 328c7ea60971..db892620a567 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); } -- 2.24.0