@@ -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
@@ -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);
@@ -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);
@@ -51,7 +51,11 @@ class MediaDeviceLinkTest : public Test
return TestSkip;
}
- dev_->acquire();
+ if (!dev_->acquire()) {
+ cerr << "Unable to acquire media device "
+ << dev_->deviceNode() << endl;
+ return TestSkip;
+ }
if (dev_->open()) {
cerr << "Failed to open media device at "
@@ -46,7 +46,8 @@ int V4L2DeviceTest::init()
if (!media_)
return TestSkip;
- media_->acquire();
+ if (!media_->acquire())
+ return TestSkip;
MediaEntity *entity = media_->getEntityByName("vivid-000-vid-cap");
if (!entity)
@@ -45,7 +45,11 @@ int V4L2SubdeviceTest::init()
return TestSkip;
}
- media_->acquire();
+ if (!media_->acquire()) {
+ cerr << "Unable to acquire media device "
+ << media_->deviceNode() << endl;
+ return TestSkip;
+ }
int ret = media_->open();
if (ret) {