[libcamera-devel,v3,1/7] test: camera: buffer_import: Fix error messages

Message ID 20200304232246.325384-2-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: V4L2BufferCache: Improve cache
Related show

Commit Message

Niklas Söderlund March 4, 2020, 11:22 p.m. UTC
The error message for when a device name can't be resolved to a video
device is wrong and applies to the next operation below it. Move it to
its correct location and add a new error message to highlight the
resolution failure.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/camera/buffer_import.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
index ab6e74bd1671e6f5..6997ea78c9f608c9 100644
--- a/test/camera/buffer_import.cpp
+++ b/test/camera/buffer_import.cpp
@@ -74,13 +74,16 @@  public:
 
 		video_ = V4L2VideoDevice::fromEntityName(media_.get(), videoDeviceName);
 		if (!video_) {
+			std::cout << "Failed to get video device from entity "
+				  << videoDeviceName << std::endl;
+			return TestFail;
+		}
+
+		if (video_->open()) {
 			std::cout << "Unable to open " << videoDeviceName << std::endl;
 			return TestFail;
 		}
 
-		if (video_->open())
-			return TestFail;
-
 		/* Configure the format. */
 		V4L2DeviceFormat format;
 		if (video_->getFormat(&format)) {