[libcamera-devel,2/2] libcamera: pipelines: ipu3: Simplify error bail out path on start()
diff mbox series

Message ID 20210111163359.43637-3-email@uajain.com
State Superseded
Headers show
Series
  • ipu3: Simplify error paths
Related show

Commit Message

Umang Jain Jan. 11, 2021, 4:33 p.m. UTC
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 <email@uajain.com>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch
diff mbox series

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();