libcamera: Fix maybe-uninitialized error

The gcc used in my current buildroot (Version 12.3) errors out with
-Wmaybe-uninitialized. Fix that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Stefan Klug 2024-06-28 11:36:02 +02:00
parent 36a4f67a75
commit 9411578be8
4 changed files with 6 additions and 9 deletions

View file

@ -166,7 +166,7 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
return { minShutter_, minGain_, exposure / (minShutter_ * minGain_) }; return { minShutter_, minGain_, exposure / (minShutter_ * minGain_) };
utils::Duration shutter; utils::Duration shutter;
double stageGain; double stageGain = 1.0;
double gain; double gain;
for (unsigned int stage = 0; stage < gains_.size(); stage++) { for (unsigned int stage = 0; stage < gains_.size(); stage++) {
@ -201,12 +201,9 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
* From here on all we can do is max out the shutter time, followed by * From here on all we can do is max out the shutter time, followed by
* the analogue gain. If we still haven't achieved the target we send * the analogue gain. If we still haven't achieved the target we send
* the rest of the exposure time to digital gain. If we were given no * the rest of the exposure time to digital gain. If we were given no
* stages to use then set stageGain to 1.0 so that shutter time is maxed * stages to use then the default stageGain of 1.0 is used so that
* before gain touched at all. * shutter time is maxed before gain is touched at all.
*/ */
if (gains_.empty())
stageGain = 1.0;
shutter = clampShutter(exposure / clampGain(stageGain)); shutter = clampShutter(exposure / clampGain(stageGain));
gain = clampGain(exposure / shutter); gain = clampGain(exposure / shutter);

View file

@ -122,7 +122,7 @@ int AwbConfig::read(const libcamera::YamlObject &params)
} }
if (priors.empty()) { if (priors.empty()) {
LOG(RPiAwb, Error) << "AwbConfig: no AWB priors configured"; LOG(RPiAwb, Error) << "AwbConfig: no AWB priors configured";
return ret; return -EINVAL;
} }
} }
if (params.contains("modes")) { if (params.contains("modes")) {

View file

@ -33,7 +33,7 @@ int DeviceEnumeratorSysfs::init()
int DeviceEnumeratorSysfs::enumerate() int DeviceEnumeratorSysfs::enumerate()
{ {
struct dirent *ent; struct dirent *ent;
DIR *dir; DIR *dir = nullptr;
static const char * const sysfs_dirs[] = { static const char * const sysfs_dirs[] = {
"/sys/subsystem/media/devices", "/sys/subsystem/media/devices",

View file

@ -802,7 +802,7 @@ void Vc4CameraData::ispInputDequeue(FrameBuffer *buffer)
void Vc4CameraData::ispOutputDequeue(FrameBuffer *buffer) void Vc4CameraData::ispOutputDequeue(FrameBuffer *buffer)
{ {
RPi::Stream *stream = nullptr; RPi::Stream *stream = nullptr;
unsigned int index; unsigned int index = 0;
if (!isRunning()) if (!isRunning())
return; return;