[v1,1/3] libcamera: pipeline: virtual: Simplify error return
diff mbox series

Message ID 20250203104318.135628-2-pobrn@protonmail.com
State Accepted
Headers show
Series
  • libcamera: pipeline: virtual: Fill buffer's metadata
Related show

Commit Message

Barnabás Pőcze Feb. 3, 2025, 10:43 a.m. UTC
Just return an `std::unique_ptr` constructed from an empty
initializer instead of doing a `reset()` on the existing
`config` variable and returning that. This is simpler.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
---
 src/libcamera/pipeline/virtual/virtual.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Kieran Bingham Feb. 3, 2025, 11:01 a.m. UTC | #1
Quoting Barnabás Pőcze (2025-02-03 10:43:24)
> Just return an `std::unique_ptr` constructed from an empty
> initializer instead of doing a `reset()` on the existing
> `config` variable and returning that. This is simpler.
> 
> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/pipeline/virtual/virtual.cpp | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
> index fc46653f6..94c2bd91e 100644
> --- a/src/libcamera/pipeline/virtual/virtual.cpp
> +++ b/src/libcamera/pipeline/virtual/virtual.cpp
> @@ -232,8 +232,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera,
>                 default:
>                         LOG(Virtual, Error)
>                                 << "Requested stream role not supported: " << role;
> -                       config.reset();
> -                       return config;
> +                       return {};
>                 }
>  
>                 std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
> -- 
> 2.48.1
> 
>
Jacopo Mondi Feb. 3, 2025, 5:31 p.m. UTC | #2
Hi Barnabás

On Mon, Feb 03, 2025 at 10:43:24AM +0000, Barnabás Pőcze wrote:
> Just return an `std::unique_ptr` constructed from an empty
> initializer instead of doing a `reset()` on the existing
> `config` variable and returning that. This is simpler.
>
> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/libcamera/pipeline/virtual/virtual.cpp | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
> index fc46653f6..94c2bd91e 100644
> --- a/src/libcamera/pipeline/virtual/virtual.cpp
> +++ b/src/libcamera/pipeline/virtual/virtual.cpp
> @@ -232,8 +232,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera,
>  		default:
>  			LOG(Virtual, Error)
>  				<< "Requested stream role not supported: " << role;
> -			config.reset();
> -			return config;
> +			return {};
>  		}
>
>  		std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
> --
> 2.48.1
>
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp
index fc46653f6..94c2bd91e 100644
--- a/src/libcamera/pipeline/virtual/virtual.cpp
+++ b/src/libcamera/pipeline/virtual/virtual.cpp
@@ -232,8 +232,7 @@  PipelineHandlerVirtual::generateConfiguration(Camera *camera,
 		default:
 			LOG(Virtual, Error)
 				<< "Requested stream role not supported: " << role;
-			config.reset();
-			return config;
+			return {};
 		}
 
 		std::map<PixelFormat, std::vector<SizeRange>> streamFormats;