[libcamera-devel,1/3] test: list-camera: Handle error on starting the CameraManager

Message ID 20200414070642.22366-2-email@uajain.com
State Accepted
Headers show
Series
  • More Coverity scans fixes
Related show

Commit Message

Umang Jain April 14, 2020, 7:06 a.m. UTC
Pointed out by Coverity DefectId=297074

Signed-off-by: Umang Jain <email@uajain.com>
---
 test/list-cameras.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart April 14, 2020, 10:10 p.m. UTC | #1
Hi Umang,

Thank you for the patch.

On Tue, Apr 14, 2020 at 07:06:57AM +0000, Umang Jain wrote:
> Pointed out by Coverity DefectId=297074
> 
> Signed-off-by: Umang Jain <email@uajain.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree. After running tests I'll push it to master.

> ---
>  test/list-cameras.cpp | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp
> index 55551d7..e6a407a 100644
> --- a/test/list-cameras.cpp
> +++ b/test/list-cameras.cpp
> @@ -21,7 +21,10 @@ protected:
>  	int init()
>  	{
>  		cm_ = new CameraManager();
> -		cm_->start();
> +		if (cm_->start()) {
> +			std::cout << "Failed to start camera" << std::endl;
> +			return TestFail;
> +		}
>  
>  		return 0;
>  	}

Patch

diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp
index 55551d7..e6a407a 100644
--- a/test/list-cameras.cpp
+++ b/test/list-cameras.cpp
@@ -21,7 +21,10 @@  protected:
 	int init()
 	{
 		cm_ = new CameraManager();
-		cm_->start();
+		if (cm_->start()) {
+			std::cout << "Failed to start camera" << std::endl;
+			return TestFail;
+		}
 
 		return 0;
 	}