summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp28
-rw-r--r--src/libcamera/pipeline/uvcvideo.cpp1
-rw-r--r--src/libcamera/pipeline/vimc.cpp5
3 files changed, 12 insertions, 22 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 1066fbe3..22673344 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -278,19 +278,20 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
imgu_dm.add("ipu3-imgu 1 viewfinder");
imgu_dm.add("ipu3-imgu 1 3a stat");
+ /*
+ * It is safe to acquire both media devices at this point as
+ * DeviceEnumerator::search() skips the busy ones for us.
+ */
cio2_ = enumerator->search(cio2_dm);
if (!cio2_)
return false;
+ cio2_->acquire();
+
imgu_ = enumerator->search(imgu_dm);
if (!imgu_)
return false;
- /*
- * It is safe to acquire both media devices at this point as
- * DeviceEnumerator::search() skips the busy ones for us.
- */
- cio2_->acquire();
imgu_->acquire();
/*
@@ -301,25 +302,18 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
* not need to be changed after.
*/
if (cio2_->open())
- goto error_release_mdev;
+ return false;
- if (cio2_->disableLinks())
- goto error_close_cio2;
+ if (cio2_->disableLinks()) {
+ cio2_->close();
+ return false;
+ }
registerCameras();
cio2_->close();
return true;
-
-error_close_cio2:
- cio2_->close();
-
-error_release_mdev:
- cio2_->release();
- imgu_->release();
-
- return false;
}
/*
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 7b697c06..adfdc4c6 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -167,7 +167,6 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
if (!video_)
LOG(UVC, Error) << "Could not find a default video device";
- media_->release();
return false;
}
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 9ba96323..3b2fcbd8 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -165,11 +165,8 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
media_->acquire();
video_ = new V4L2Device(media_->getEntityByName("Raw Capture 1"));
-
- if (video_->open()) {
- media_->release();
+ if (video_->open())
return false;
- }
std::set<Stream *> streams{ &stream_ };
std::shared_ptr<Camera> camera = Camera::create(this, "VIMC Sensor B",