summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-04-14 00:28:53 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-17 01:33:12 +0200
commit12053cf8e6a98104b6c765e1ac8a34b8f7a02eed (patch)
treee9e45417a200c28e34ac23f53a8daa01591b495b /src
parentb9a47058eb46281dd0c365b9e18a323994791498 (diff)
libcamera: Always check return value of MediaDevice::acquire()
In preparation for adding more responsibility to MediaDevice::acquire() remove unneeded calls to acquire() and release(), and make sure all needed calls to acquire() are checked and acted on. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp10
-rw-r--r--src/libcamera/pipeline/uvcvideo.cpp3
-rw-r--r--src/libcamera/pipeline/vimc.cpp3
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 00416625..75e878af 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -614,21 +614,19 @@ 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.
- */
cio2MediaDev_ = enumerator->search(cio2_dm);
if (!cio2MediaDev_)
return false;
- cio2MediaDev_->acquire();
+ if (!cio2MediaDev_->acquire())
+ return false;
imguMediaDev_ = enumerator->search(imgu_dm);
if (!imguMediaDev_)
return false;
- imguMediaDev_->acquire();
+ if (!imguMediaDev_->acquire())
+ return false;
/*
* Disable all links that are enabled by default on CIO2, as camera
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 5d2f1c98..e40b052f 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -183,7 +183,8 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
if (!media_)
return false;
- media_->acquire();
+ if (!media_->acquire())
+ return false;
std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this);
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index cdf43770..7b6ebd4c 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -193,7 +193,8 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
if (!media_)
return false;
- media_->acquire();
+ if (!media_->acquire())
+ return false;
std::unique_ptr<VimcCameraData> data = utils::make_unique<VimcCameraData>(this);