From 69a894c4adad524d3063dd027f5c4774485cf9db Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Fri, 6 Sep 2024 14:44:39 +0100 Subject: [PATCH] pipeline: rpi: Fix invalid access to CameraData::sensorInfo_ sensorInfo_ currently gets populated in configureIPA(), but is possibly referenced in platformConfigure() which is called first. Fix this by populating sensorInfo_ straight after configuring the sensor in configure(), ensuring the fields are valid in the call to platformConfigure(). Signed-off-by: Naushir Patuck --- .../pipeline/rpi/common/pipeline_base.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index b9759b682..d9a2766d5 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -529,6 +529,13 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config) if (ret) return ret; + /* We store the IPACameraSensorInfo for digital zoom calculations. */ + ret = data->sensor_->sensorInfo(&data->sensorInfo_); + if (ret) { + LOG(RPI, Error) << "Failed to retrieve camera sensor info"; + return ret; + } + /* * Platform specific internal stream configuration. This also assigns * external streams which get configured below. @@ -1201,13 +1208,6 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config if (ret) return ret; - /* We store the IPACameraSensorInfo for digital zoom calculations. */ - ret = sensor_->sensorInfo(&sensorInfo_); - if (ret) { - LOG(RPI, Error) << "Failed to retrieve camera sensor info"; - return ret; - } - /* Always send the user transform to the IPA. */ Transform transform = config->orientation / Orientation::Rotate0; params.transform = static_cast(transform);