mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
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>
This commit is contained in:
parent
b9a47058eb
commit
12053cf8e6
6 changed files with 13 additions and 20 deletions
|
@ -45,20 +45,16 @@ int V4L2SubdeviceTest::init()
|
|||
return TestSkip;
|
||||
}
|
||||
|
||||
media_->acquire();
|
||||
|
||||
int ret = media_->open();
|
||||
if (ret) {
|
||||
cerr << "Unable to open media device: " << media_->deviceNode()
|
||||
<< ": " << strerror(ret) << endl;
|
||||
media_->release();
|
||||
return TestSkip;
|
||||
}
|
||||
|
||||
MediaEntity *videoEntity = media_->getEntityByName("Scaler");
|
||||
if (!videoEntity) {
|
||||
cerr << "Unable to find media entity 'Scaler'" << endl;
|
||||
media_->release();
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
|
@ -67,7 +63,6 @@ int V4L2SubdeviceTest::init()
|
|||
if (ret) {
|
||||
cerr << "Unable to open video subdevice "
|
||||
<< scaler_->entity()->deviceNode() << endl;
|
||||
media_->release();
|
||||
return TestSkip;
|
||||
}
|
||||
|
||||
|
@ -76,7 +71,5 @@ int V4L2SubdeviceTest::init()
|
|||
|
||||
void V4L2SubdeviceTest::cleanup()
|
||||
{
|
||||
media_->release();
|
||||
|
||||
delete scaler_;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue