From patchwork Mon Jan 11 16:33:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 10847 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 0C678BD808 for ; Mon, 11 Jan 2021 16:34:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D0B3C680BE; Mon, 11 Jan 2021 17:34:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="kUKvgeSG"; dkim-atps=neutral Received: from mail.uajain.com (static.126.159.217.95.clients.your-server.de [95.217.159.126]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A54C680BE for ; Mon, 11 Jan 2021 17:34:12 +0100 (CET) From: Umang Jain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail; t=1610382851; bh=yZW2MmJhm1SRNzcqFX+Be/eDcmIZUiLB573/Jnrb3z8=; h=From:To:Cc:Subject:In-Reply-To:References; b=kUKvgeSG/eZA87qi0/sGD262SOAmSXwTSGxs3MBcZEh7uymXmPJito87jTogRUegD 8Umr++RbcAz6C4vEThzJ3eFU19X5NTucD0IQDqvlBMMn+4cT0p0BsOMTmn3TGleEqO hBUxEPQ6KneWe0ok8vKPLFYGH+mDey4xJEmToiR/hRSZXXaU0Fq2hnGifF4I0O/K2s G08eM3uXRztT3L29pew9aurM+n7hSAa8Q0FtMVKWNRYmmCVj6DZ80WhYKznagK+ZFr Gc8tsmUSuK0Krmnz99tySCZ5IigukJRpx2bvvZNq1WcuvoGRRZWiH7WhRzP5ymhOzW WZJmL1zy89f/g== To: libcamera-devel@lists.libcamera.org Date: Mon, 11 Jan 2021 22:03:59 +0530 Message-Id: <20210111163359.43637-3-email@uajain.com> In-Reply-To: <20210111163359.43637-1-email@uajain.com> References: <20210111163359.43637-1-email@uajain.com> Mime-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: pipelines: ipu3: Simplify error bail out 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" On the bail out path, always ensure that ImgU and CIO2 are stopped before freeing the buffers. V4L2VideoDevice class guarantees that calling stop() without having to call start() is harmless, hence use this guarantee to simplify error paths. Signed-off-by: Umang Jain --- src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f1151733..73304ea7 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -617,15 +617,14 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] ControlList *con goto error; ret = imgu->start(); - if (ret) { - imgu->stop(); - cio2->stop(); + if (ret) goto error; - } return 0; error: + imgu->stop(); + cio2->stop(); freeBuffers(camera); LOG(IPU3, Error) << "Failed to start camera " << camera->id();