Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3165426pxb; Fri, 5 Nov 2021 10:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4s5VSCt/qRd+Kl8rFafbMXVxYnWBqHYbBnF1va8M13K7kF1lx0Pu2N127XuxOCK+x91SE X-Received: by 2002:a05:6e02:18c5:: with SMTP id s5mr8364024ilu.193.1636134621353; Fri, 05 Nov 2021 10:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636134621; cv=none; d=google.com; s=arc-20160816; b=KDy0hDgXC2YxsmIFCOrE1MtfOGv8xvB+fenRHxboX+dQpgqocEBwlAnPevds243NDu On/YsuRgPq1f57T/QKIRnPFY9PBn498UmMYEUy201QmBWSiYrbH7vC2pT+fZtoEeI9P5 Wc32W7AJfYhFqH6oaYcHOTFghR0UYUXaXkANG4PoUu1zQZfwEylAUuu0u+SzVsA43Q4Z PlTPVGrTb5WZG/y0OMbnG+amnY2qGsxLw/YF+dG6rzzpJPewj/dds80kUz38xtt9EYDL TFO6mcYgMRoti55Atteakkcc6mgy+BeOJP4yTBhFq2DKniK2UY4aYLRoCucPhEhvgrvF nIiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=ziTVX6AIDAxI5iyIKp+PKfRbwHpR62SFOpKjs9884G8=; b=mUNXcwRM9obYyCgQrmuejy4Px6hhPnuWsdkwKEpZNOr3q+70kNnrKDl8juWiOzqel7 1KVrFbjsCGRVizBY6Ym4rpGVNMVCGRmAssH1yegqThueNBfdZLqDie6mno4epVC7goDc WcgQqcgeMvgGg/NOR07GuN2cJneY6VRgQ/obuz9moh02w6Ub8ifXYOs8rHFdNOrM0aCQ 8R3CCaIIwAyCMyfqq7yZoPOjZX9F+7zR70OI15+v/Jvy35HC0ZokUjIlwGv2As1x+Acz bWwdCAviuerXpJBHhgTcVG0YtSrAuMGWnSi2r2X6K6meJe0sgl5UVN/m2JXZnaR66qBR /x/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b="GLS/N7C5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si11266002ilm.150.2021.11.05.10.50.08; Fri, 05 Nov 2021 10:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b="GLS/N7C5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234538AbhKERvM (ORCPT + 99 others); Fri, 5 Nov 2021 13:51:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:35264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234496AbhKERvE (ORCPT ); Fri, 5 Nov 2021 13:51:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE6106125F; Fri, 5 Nov 2021 17:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636134503; bh=nLdqNgjvZNYqkrDeJl3wT8Lm+V+O4cWqrnmRjff8ulY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GLS/N7C5fe9RTOeoNe1L8xq9ideWE/XJjpm9VlQRTER/lrEhgqbsVeWrvTW0WpYW0 2REnZPVZhHdqJSpfUPAjylvAhEOZLFjOzO+EbN+kuh0Z5LnJrIAGA5RMEe2qFTX+tS dXt6+jT3ebG1t3CMNwpVgun/kAzINY0R06kSe5vC31poukCESNBGbXY4yoK+y5XfF/ DXPr65rhx0icbopnq4g7dJkXuEWbenXiINnpUdOtQ2/ly3S+BScv8bOB1I23JQyPft ecC8cvdpd9ixQwQPFwaNCiM5Kv0fwbKtTsxuZYR8wWCwGq0wYGnxGzn+fZ8/XuZkCE eqPDqOGpAZcjA== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mj3K4-007eNo-Eo; Fri, 05 Nov 2021 17:48:16 +0000 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Deepak R Varma , Greg Kroah-Hartman , Mauro Carvalho Chehab , Sakari Ailus , Tsuchiya Yuto , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 6/8] media: atomisp: sh_css_sp: better handle pipeline config errors Date: Fri, 5 Nov 2021 17:48:13 +0000 Message-Id: <1a656b0ae4d245375c8c1af9a01e3bf1b8618f5f.1636134411.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <286ba3e4f25e9ba2ab78de4cbf010f18167b2604.1636134411.git.mchehab+huawei@kernel.org> References: <286ba3e4f25e9ba2ab78de4cbf010f18167b2604.1636134411.git.mchehab+huawei@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If something gets wrong while setup a pipeline, return an error code. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/sh_css_sp.c | 66 +++++++++++++------ 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index fa74ac172f94..f36f44b5e5b2 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -812,25 +812,47 @@ is_sp_stage(struct ia_css_pipeline_stage *stage) return stage->sp_func != IA_CSS_PIPELINE_NO_FUNC; } -static int -configure_isp_from_args( - const struct sh_css_sp_pipeline *pipeline, - const struct ia_css_binary *binary, - const struct sh_css_binary_args *args, - bool two_ppc, - bool deinterleaved) +static int configure_isp_from_args(const struct sh_css_sp_pipeline *pipeline, + const struct ia_css_binary *binary, + const struct sh_css_binary_args *args, + bool two_ppc, + bool deinterleaved) { - ia_css_fpn_configure(binary, &binary->in_frame_info); - ia_css_crop_configure(binary, &args->delay_frames[0]->info); - ia_css_qplane_configure(pipeline, binary, &binary->in_frame_info); - ia_css_output0_configure(binary, &args->out_frame[0]->info); - ia_css_output1_configure(binary, &args->out_vf_frame->info); - ia_css_copy_output_configure(binary, args->copy_output); - ia_css_output0_configure(binary, &args->out_frame[0]->info); - ia_css_iterator_configure(binary, &args->in_frame->info); - ia_css_dvs_configure(binary, &args->out_frame[0]->info); - ia_css_output_configure(binary, &args->out_frame[0]->info); - ia_css_raw_configure(pipeline, binary, &args->in_frame->info, &binary->in_frame_info, two_ppc, deinterleaved); + int ret; + + ret = ia_css_fpn_configure(binary, &binary->in_frame_info); + if (ret) + return ret; + ret = ia_css_crop_configure(binary, &args->delay_frames[0]->info); + if (ret) + return ret; + ret = ia_css_qplane_configure(pipeline, binary, &binary->in_frame_info); + if (ret) + return ret; + ret = ia_css_output0_configure(binary, &args->out_frame[0]->info); + if (ret) + return ret; + ret = ia_css_output1_configure(binary, &args->out_vf_frame->info); + if (ret) + return ret; + ret = ia_css_copy_output_configure(binary, args->copy_output); + if (ret) + return ret; + ret = ia_css_output0_configure(binary, &args->out_frame[0]->info); + if (ret) + return ret; + ret = ia_css_iterator_configure(binary, &args->in_frame->info); + if (ret) + return ret; + ret = ia_css_dvs_configure(binary, &args->out_frame[0]->info); + if (ret) + return ret; + ret = ia_css_output_configure(binary, &args->out_frame[0]->info); + if (ret) + return ret; + ret = ia_css_raw_configure(pipeline, binary, &args->in_frame->info, &binary->in_frame_info, two_ppc, deinterleaved); + if (ret) + return ret; /* * FIXME: args->delay_frames can be NULL here @@ -842,8 +864,12 @@ configure_isp_from_args( * without crashing, but the pipeline should likely be built without * adding it at the first place (or there are a hidden bug somewhere) */ - ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay); - ia_css_tnr_configure(binary, args->tnr_frames); + ret = ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay); + if (ret) + return ret; + ret = ia_css_tnr_configure(binary, args->tnr_frames); + if (ret) + return ret; ia_css_bayer_io_config(binary, args); return 0; } -- 2.31.1