From 735f0ffeaac736f91c35774e575b1280ba868d69 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 26 Jul 2022 02:36:38 +0300 Subject: ipa: raspberrypi: Replace Fatal log by error propagation Replace the Fatal log messages that cause an abort during tuning data read with Error messages and proper error propagation to the caller. Signed-off-by: Laurent Pinchart Reviewed-by: Naushir Patuck Tested-by: Naushir Patuck --- src/ipa/raspberrypi/controller/rpi/ccm.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/ipa/raspberrypi/controller/rpi/ccm.cpp') diff --git a/src/ipa/raspberrypi/controller/rpi/ccm.cpp b/src/ipa/raspberrypi/controller/rpi/ccm.cpp index f0110d38..9588e94a 100644 --- a/src/ipa/raspberrypi/controller/rpi/ccm.cpp +++ b/src/ipa/raspberrypi/controller/rpi/ccm.cpp @@ -44,12 +44,16 @@ int Matrix::read(boost::property_tree::ptree const ¶ms) double *ptr = (double *)m; int n = 0; for (auto it = params.begin(); it != params.end(); it++) { - if (n++ == 9) - LOG(RPiCcm, Fatal) << "Ccm: too many values in CCM"; + if (n++ == 9) { + LOG(RPiCcm, Error) << "Too many values in CCM"; + return -EINVAL; + } *ptr++ = it->second.get_value(); } - if (n < 9) - LOG(RPiCcm, Fatal) << "Ccm: too few values in CCM"; + if (n < 9) { + LOG(RPiCcm, Error) << "Too few values in CCM"; + return -EINVAL; + } return 0; } @@ -78,13 +82,17 @@ int Ccm::read(boost::property_tree::ptree const ¶ms) if (ret) return ret; if (!config_.ccms.empty() && - ctCcm.ct <= config_.ccms.back().ct) - LOG(RPiCcm, Fatal) << "Ccm: CCM not in increasing colour temperature order"; + ctCcm.ct <= config_.ccms.back().ct) { + LOG(RPiCcm, Error) << "CCM not in increasing colour temperature order"; + return -EINVAL; + } config_.ccms.push_back(std::move(ctCcm)); } - if (config_.ccms.empty()) - LOG(RPiCcm, Fatal) << "Ccm: no CCMs specified"; + if (config_.ccms.empty()) { + LOG(RPiCcm, Error) << "No CCMs specified"; + return -EINVAL; + } return 0; } -- cgit v1.2.1