{"id":10850,"url":"https://patchwork.libcamera.org/api/1.1/patches/10850/?format=json","web_url":"https://patchwork.libcamera.org/patch/10850/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210112045140.10979-3-email@uajain.com>","date":"2021-01-12T04:51:40","name":"[libcamera-devel,v2,2/2] libcamera: pipelines: ipu3: Simplify error bail out path on start()","commit_ref":"44058f1c68a9789f0e9fbdfcb64d99d6313ed121","pull_url":null,"state":"accepted","archived":false,"hash":"60415df6abf3c9f3f40ce705dea1c7a540394b21","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/1.1/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/10850/mbox/","series":[{"id":1575,"url":"https://patchwork.libcamera.org/api/1.1/series/1575/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1575","date":"2021-01-12T04:51:38","name":"Simplify error paths","version":2,"mbox":"https://patchwork.libcamera.org/series/1575/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10850/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10850/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 54EFBBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Jan 2021 04:51:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2599D6054E;\n\tTue, 12 Jan 2021 05:51:52 +0100 (CET)","from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 490506054E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Jan 2021 05:51:50 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"Xf3AvxHh\"; dkim-atps=neutral","From":"Umang Jain <email@uajain.com>","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1610427109; bh=yZW2MmJhm1SRNzcqFX+Be/eDcmIZUiLB573/Jnrb3z8=;\n\th=From:To:Cc:Subject:In-Reply-To:References;\n\tb=Xf3AvxHhP3OkBAXAb/fwrqWTVko25TirTp6XnN9uBWgNafZn8WK9n3U7bUztg2Xqv\n\tSBPj2+CZ8NSiY4JFLl11a+qOjR3qyrbDhtA6VC2YFjO1nwbgGX/+PQiyzu9VRBha4O\n\tatD/AImrB8E9jqUo0nVORUmNUfqjYE525u4ZzGcoXJmghLb4/bthDpi5goBYyIWoWY\n\tQ6U0oRvx0nXui+OrPcokiddsYa+piaqx9MlCjNUOgA8P6P8GXM1GJOyL4vZ9fG7hJv\n\tA1kYugHxvvb+hn/1tzlXhlhe8NaLLBOU8seqmxH6nHvmm9stBD5DqYk4qRMpT1VP7g\n\tdcmpwjimYPPaQ==","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 12 Jan 2021 10:21:40 +0530","Message-Id":"<20210112045140.10979-3-email@uajain.com>","In-Reply-To":"<20210112045140.10979-1-email@uajain.com>","References":"<20210112045140.10979-1-email@uajain.com>","Mime-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 2/2] libcamera: pipelines: ipu3:\n\tSimplify error bail out path on start()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"On the bail out path, always ensure that ImgU and CIO2 are stopped\nbefore freeing the buffers. V4L2VideoDevice class guarantees that\ncalling stop() without having to call start() is harmless, hence use\nthis guarantee to simplify error paths.\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex f1151733..73304ea7 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -617,15 +617,14 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] ControlList *con\n \t\tgoto error;\n \n \tret = imgu->start();\n-\tif (ret) {\n-\t\timgu->stop();\n-\t\tcio2->stop();\n+\tif (ret)\n \t\tgoto error;\n-\t}\n \n \treturn 0;\n \n error:\n+\timgu->stop();\n+\tcio2->stop();\n \tfreeBuffers(camera);\n \tLOG(IPU3, Error) << \"Failed to start camera \" << camera->id();\n \n","prefixes":["libcamera-devel","v2","2/2"]}