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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user