pipeline: rpi: Fix potential empty optional read

If `!target`, then `*target` is undefined behaviour, so check if the optional
is empty when printing the error message. Simplify the check as well.

Fixes: 6c71ee1f15 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")
Fixes: 841ef2b4bb ("pipeline: rpi: Add support for Raspberry Pi 5")
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
This commit is contained in:
Barnabás Pőcze 2025-03-21 10:51:05 +01:00
parent 61d93434f5
commit a2a7f4fc2d
2 changed files with 4 additions and 4 deletions

View file

@ -1350,9 +1350,9 @@ int PiSPCameraData::platformPipelineConfigure(const std::unique_ptr<YamlObject>
}
std::optional<std::string> target = (*root)["target"].get<std::string>();
if (!target || *target != "pisp") {
if (target != "pisp") {
LOG(RPI, Error) << "Unexpected target reported: expected \"pisp\", got "
<< *target;
<< (target ? target->c_str() : "(unknown)");
return -EINVAL;
}

View file

@ -510,9 +510,9 @@ int Vc4CameraData::platformPipelineConfigure(const std::unique_ptr<YamlObject> &
}
std::optional<std::string> target = (*root)["target"].get<std::string>();
if (!target || *target != "bcm2835") {
if (target != "bcm2835") {
LOG(RPI, Error) << "Unexpected target reported: expected \"bcm2835\", got "
<< *target;
<< (target ? target->c_str() : "(unknown)");
return -EINVAL;
}