[libcamera-devel,2/2] libcamera: ipu3: Re-work camera data registration

Message ID 20190126162859.32031-3-jacopo@jmondi.org
State Accepted
Commit 4f32a3b408430f9bbbac260e8aedd1b90244639d
Headers show
Series
  • libcamera: ipu3: more review fixes
Related show

Commit Message

Jacopo Mondi Jan. 26, 2019, 4:28 p.m. UTC
Re-work camera data registration.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Patch

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 64f639f..80f4a7b 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -210,18 +210,16 @@  void PipelineHandlerIPU3::registerCameras()
 		 * registered. The 'camera' shared pointer goes out of scope
 		 * and deletes the Camera it manages.
 		 */
-		V4L2Device *videoDev = createVideoDevice(id);
-		if (!videoDev) {
+		std::unique_ptr<IPU3CameraData> data = utils::make_unique<IPU3CameraData>();
+		data->dev_ = createVideoDevice(id);
+		if (!data->dev_) {
 			LOG(IPU3, Error)
 				<< "Failed to register camera["
 				<< numCameras << "] \"" << cameraName << "\"";
 			continue;
 		}
 
-		IPU3CameraData *data = new IPU3CameraData();
-		data->dev_ = videoDev;
-		setCameraData(camera.get(),
-			      std::move(std::unique_ptr<IPU3CameraData>(data)));
+		setCameraData(camera.get(), std::move(data));
 		registerCamera(std::move(camera));
 
 		LOG(IPU3, Info)