From patchwork Thu Sep 8 18:48:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17355 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id EA160C3282 for ; Thu, 8 Sep 2022 18:49:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A96B1620EE; Thu, 8 Sep 2022 20:49:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662970; bh=nBBTrKaYKbKVSnuwyNWWnmYMjMiwyIS2GIVgZfHEF+c=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=VJqVu1vG9im9HV6wC8a4iCYuBfRZozyMzcaz+CRkUYc6q9DP3osVnZkic9lwFh1m/ YxgDRhQTw1GmLNpt6Xf7h7b2yvWVJycOwf2f+Fu2lnhpc91VVtr4iAhrW8VJ+ZFG6O T2Ms8kRL5xfWy0c442iuJ2ZMFYvll5azemHaNoBskjvEnC9I8DUG5q7lZ+MsWZJg1z Wh03TApMlH3mCqOEyARQJkDSI01nrPY6BBrz6a3bK7MbnIqjlZuyMHlEmv+pbdxAJ/ BgS3jkyyGHC194rNxyWYQHc5sKSOr/kCkVmN/U9alypotUmpB8z3OWYL9sjzPUS0ZI XiV2S6wR+W2Gw== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60053.outbound.protection.outlook.com [40.107.6.53]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A010620B2 for ; Thu, 8 Sep 2022 20:49:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="F0l2WaCi"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9E1EI1gsQQn40TDwbsSYA/KhV90jFffLeP5eJFvX+UsagKsAnBwmCobnN67y28pwD4DkB5x6yjuOWDOL4cdR2PEeGnUHnbkmjDG/cSGyG79VQlyDcdaFfz+HbluXLvN8aFsmpL9YOWptWXnTMWARJcUk9lFMFiE1cu9ORcx8HwmBmPAb49eue/+6OFHP6z5q4kgpNib/LhUQ7fm03ZmVmRBy/k+voYWFJ+cpg5imxQMx1g3dWGn/GhN+ByDxnipeqSurpw5iyvqgN2YaRcYLPLOQvX401S3SBFYHwmWi4RUi6xjkx1cY4OZ/M2GJcRmzb8PAgKgrEbB5GMJBwyA/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AK/bi6rxdBbz8x6SIPHndU60DEbeSpBfsdLp6WoV1V8=; b=RgoHm8kydW/pcyn66uLZkubeU/BEJ7DPp2Z/g1f9VI6RPiaXZscMLxSSPjaeOmTXuift7j0kDFhVaDSv7gl+uDlv8ix4FwnHwwAD395W2V8pMLnu4oCU+DWPn51sQSQ/RWMYl4Hckfh8Qv5gtAbUo/6vLJPKB2gkpTKj7ecP+1a0+qezGcnUzR/726JG6BB1jYAW843jOZy26I4kLNDPcSBmR8VgTWFzM3SwCUHRGdQkQvpFzAF4FNL7dPUeEcEkNwkyDi4QQidaiW2Kt0wOVL/w4T6YiP5bjMgoqCWTlp88WzvKKHGRUPDd28144p1t3rrNVrLueSRi0wAAE4jGFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AK/bi6rxdBbz8x6SIPHndU60DEbeSpBfsdLp6WoV1V8=; b=F0l2WaCi8C9J+fMgPxSoKjFH5lcg91lUKQE488a4mXx7ma9ALFUBair29stGoeFqGFToQTE4aNbA7pr4CpiM+B7K+1Vb/HKKvyIPRoa48C30NR0TzgFDIaAlycTybLLVOr8UPWrj3Ghu4bgHtnNqEAmwQhMwn6aupyoDje0T5jU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AS8PR04MB8852.eurprd04.prod.outlook.com (2603:10a6:20b:42f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Thu, 8 Sep 2022 18:49:22 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a%3]) with mapi id 15.20.5612.019; Thu, 8 Sep 2022 18:49:22 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:49 +0200 Message-Id: <20220908184850.1874303-14-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR3P250CA0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:57::6) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8703:EE_|AS8PR04MB8852:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ae63976-5dec-476f-31e6-08da91cad816 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z8QbVJzTwrTbfMN738DBQf657h7Us8TNVz6JOPa7qaXQKbz3F0Xn6sSozDoHDw4q4XkMe+S+2opia+HqKDZEvE0hYt9wlvs8tXtvUYEu/VL5RqT92jIThshUHTmRUslMC1A/Ar0nbd171vDFi/6ORpMdFZKYCnsXO90jIKpUuhFXZwm3KzTdsp2+X8Qhe9H27Q4I/sByoITkIK0rFemDV3CeLqx+kaqF76JC80tlVyEzen9/wGF2hcKtTXNqGZKWXKMbL2W67C22acHVFkdg/+OsPzLrTcsCVPWxA+vddY5PofpOX4sVBUgvYgBjAjZIiSW3+DefRkljuYG3CA2UEwsIE/g5tq/J8dX+WQU60LwxkRZRpDRzeEgy0Jzq7wwIUJvYFNZVYCc04zswRI8IsdsZiyuX79eIJ2SXTXuHtXQ4qG7+DnkjPZSe9DPjXAFVbbrYTMvEObM+tBGl9U7kY0AbfSzX6ILy+hGa2OTPUHuXhP7JxVr39IDvFGo2VFZabDWsV5v/uR7FHS9ZqPb1kFJJfjVVm1dND4msikHX27B+J9jUa5WVvq6JJJBekUXXrngRUNJ63bRV2DW7SIGx6PjPj1AUX7M3lxIaLCLYcsqM5LwbcVqP7XUo1sCxEjYr16JTsZfURux1d0SGpjAU1VqoQ3GNIBxKlUubYDYBovrRrAOE3LydLfeJIwvBAW4i5cgy86uUI4JnKp9YQnCAFA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8703.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(38100700002)(66556008)(66476007)(66946007)(8936002)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cJGSrcPm6D18Dmc1rzFPJJAHiuxaqQk1viIwwxXt15ElJCGGe/xnGgkC3fJuwaOp8kthxiEl6GyM+Wfb+FN64cD5nREmZCv0VPYpmCkXgUNjoi9JWFZtAwdQ6rOGeBCy+LnSWg0absXYCg+adEAKvhT4xrtgw7UNLTCBV7D+GRm2gHAImQ04TSDDRlGWXJkWwkw5vq8ctk+ukfQ7prmlqLHzN1hgOVEDl5RXuT8hVJKZ7Z6e0XLAUujDS1MNxddY75tObN08Mwz6RJaGOX+udHVT9mAUau7qqieGbCsk2UYCDvS78tkMTgL6w7LeNtR+rljPF8H/7TqKJ0Fr7nrp2Mz5qCKyDpicTuAbiV4n7j6njsCo8wecEzvyEs4le4weuaap1TNA4Wm1hPe+pKiEnP4eAIazIIwrLzBl8CLiu4rd9/faQs2gylqi6bvQXnBEs2IoDn4QB1oujC01UnJdVy6ocMbrQlH5DDa7tDpozAIDsi3MtNfU+p6Dm/j53x0IB+eJYS7weXOqopI0F9in8etMWFoAXgozMu9N+TGt1rHxYjUNbRgoM4fsoYTuIETdsm+dLetyxBX2U3jH9xYK8eqZaGiPHx4CsLyGq17Zt+o/pzlRxGLjDztZStZ7y0l5XHmEAkcYVZosdpu1wM1aFR4H+VQQ4SAo2pAMUZIT5BnfYYcWH21L17accztb1QKXzPVJXcPBPEUe3L+L9maB3NI54Wh+CD7BTxOAD+G5ioX8NVMAn86NZjL15aq8Pb9khHJS5290E+FFb9t8+aflfrqJ7bcPhVU4RGObNPdZhoKKB59Q5NbYUs9qO8GQ0iui2/jzTB7BXzW/o2JdOjsjkIOrQASvNCzzS9S0khVow4VgUqChJ82zPFYKQrHmzcWqcNt+tFBJvMkExZx1+R1Xss33fFeuX4hYn+6GyKWb3mGXDYDCUP7zkFWl/7sfm0A3QsuWVYmHEhbOaRtPxfbZhvK0ppXx4L/b3LJxm3jAQvYXNIGqzy3AHT5fPXo2TV24vrFbhjkE5250h2HQPInbUYzsyLR5zj+FK2VP+fpED4eJOaGqK00T0r0ops6j2mR/4H0evOqeW/c/s3kuOCPRx3yIkfxhUeg4sXkm/y0V4R3pvVo106X+uTOIO6n0w5gBUVJX8dksM5b4VC/+ZAHrdlcbuFf9RVLITxuta9LCCteBRJ58cHGrjNb0yIeFOTvuoOfwKBGJFKjRl4fRhHlmcMN94C7Tue8zBZ+UKSvkE8m4N7MdguxYutCZL6w/hIBrWJpPv0ZCOtyCPzxKkg+Qi9d2gvsAez2m1KdUwJJ84DCZkbLA76tut2maczkoGG7XQLLUgSkSxS0RkgZsXpQg+nXEHAaB28KSSfXGXYX86McADxMNuYpSqXDmn8KXD5jRpWZ0FNkkmCOLJ1Ce0EwXl0Omtl7H2n+VQ1JPzX0gUO1SF+XGxfE2KgiGRRFDea6m6G+CBpl00XwdUBq3zGGofHhviqINShbQzTDdarrBhK98IYvDfp3iOorezEDlciF+uVNDiso2eNmPdqPrOKDOsi6eINRAs3GSOkx7Bhh5V/WcxUPPl8/ESSNuz5+ZLzMEH4xPY05B+zMejamVE4fMLIENeQL7nHHTXgyPvSAO467sLEWJ+3PTEbptdbo+NvyO74QZ9G+RPeqi7RYHVim4cg== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ae63976-5dec-476f-31e6-08da91cad816 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 18:49:22.2038 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3TcaSGIDF3qa1BN55oGHfXtkBQkmUt8vx1kK0oSS34o2iIxnEVCkPW1XzwAK777khrrZsHu0eXNsbT7tOBZBDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 13/14] libcamera: pipeline: rkisp1: Factorize errors handling path on start() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xavier Roumegue via libcamera-devel From: Xavier Roumegue Reply-To: Xavier Roumegue Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Signed-off-by: Xavier Roumegue --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 45 +++++++++++------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 25fbf9f1..c1522ca6 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -828,59 +828,56 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL ret = data->ipa_->start(); if (ret) { - freeBuffers(camera); LOG(RkISP1, Error) << "Failed to start IPA " << camera->id(); - return ret; + goto ipa_err; } data->frame_ = 0; ret = param_->streamOn(); if (ret) { - data->ipa_->stop(); - freeBuffers(camera); LOG(RkISP1, Error) << "Failed to start parameters " << camera->id(); - return ret; + goto param_err; } ret = stat_->streamOn(); if (ret) { - param_->streamOff(); - data->ipa_->stop(); - freeBuffers(camera); LOG(RkISP1, Error) << "Failed to start statistics " << camera->id(); - return ret; + goto stat_err; } if (data->mainPath_->isEnabled()) { ret = mainPath_.start(); - if (ret) { - param_->streamOff(); - stat_->streamOff(); - data->ipa_->stop(); - freeBuffers(camera); - return ret; - } + if (ret) + goto main_err; } if (hasSelfPath_ && data->selfPath_->isEnabled()) { ret = selfPath_.start(); - if (ret) { - mainPath_.stop(); - param_->streamOff(); - stat_->streamOff(); - data->ipa_->stop(); - freeBuffers(camera); - return ret; - } + if (ret) + goto self_err; } isp_->setFrameStartEnabled(true); activeCamera_ = camera; + goto no_err; + +self_err: + if (data->mainPath_->isEnabled()) + mainPath_.stop(); +main_err: + stat_->streamOff(); +stat_err: + param_->streamOff(); +param_err: + data->ipa_->stop(); +ipa_err: + freeBuffers(camera); +no_err: return ret; }