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/awb.cpp | 42 ++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'src/ipa/raspberrypi/controller/rpi/awb.cpp') diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index cd97d9f4..d8c96654 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -46,16 +46,22 @@ static int readCtCurve(Pwl &ctR, Pwl &ctB, for (auto it = params.begin(); it != params.end(); it++) { double ct = it->second.get_value(); assert(it == params.begin() || ct != ctR.domain().end); - if (++it == params.end()) - LOG(RPiAwb, Fatal) << "AwbConfig: incomplete CT curve entry"; + if (++it == params.end()) { + LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry"; + return -EINVAL; + } ctR.append(ct, it->second.get_value()); - if (++it == params.end()) - LOG(RPiAwb, Fatal) << "AwbConfig: incomplete CT curve entry"; + if (++it == params.end()) { + LOG(RPiAwb, Error) << "AwbConfig: incomplete CT curve entry"; + return -EINVAL; + } ctB.append(ct, it->second.get_value()); num++; } - if (num < 2) - LOG(RPiAwb, Fatal) << "AwbConfig: insufficient points in CT curve"; + if (num < 2) { + LOG(RPiAwb, Error) << "AwbConfig: insufficient points in CT curve"; + return -EINVAL; + } return 0; } @@ -78,12 +84,16 @@ int AwbConfig::read(boost::property_tree::ptree const ¶ms) ret = prior.read(p.second); if (ret) return ret; - if (!priors.empty() && prior.lux <= priors.back().lux) - LOG(RPiAwb, Fatal) << "AwbConfig: Prior must be ordered in increasing lux value"; + if (!priors.empty() && prior.lux <= priors.back().lux) { + LOG(RPiAwb, Error) << "AwbConfig: Prior must be ordered in increasing lux value"; + return -EINVAL; + } priors.push_back(prior); } - if (priors.empty()) - LOG(RPiAwb, Fatal) << "AwbConfig: no AWB priors configured"; + if (priors.empty()) { + LOG(RPiAwb, Error) << "AwbConfig: no AWB priors configured"; + return ret; + } } if (params.get_child_optional("modes")) { for (auto &p : params.get_child("modes")) { @@ -93,8 +103,10 @@ int AwbConfig::read(boost::property_tree::ptree const ¶ms) if (defaultMode == nullptr) defaultMode = &modes[p.first]; } - if (defaultMode == nullptr) - LOG(RPiAwb, Fatal) << "AwbConfig: no AWB modes configured"; + if (defaultMode == nullptr) { + LOG(RPiAwb, Error) << "AwbConfig: no AWB modes configured"; + return -EINVAL; + } } minPixels = params.get("min_pixels", 16.0); minG = params.get("min_G", 32); @@ -103,8 +115,10 @@ int AwbConfig::read(boost::property_tree::ptree const ¶ms) coarseStep = params.get("coarse_step", 0.2); transversePos = params.get("transverse_pos", 0.01); transverseNeg = params.get("transverse_neg", 0.01); - if (transversePos <= 0 || transverseNeg <= 0) - LOG(RPiAwb, Fatal) << "AwbConfig: transverse_pos/neg must be > 0"; + if (transversePos <= 0 || transverseNeg <= 0) { + LOG(RPiAwb, Error) << "AwbConfig: transverse_pos/neg must be > 0"; + return -EINVAL; + } sensitivityR = params.get("sensitivity_r", 1.0); sensitivityB = params.get("sensitivity_b", 1.0); if (bayes) { -- cgit v1.2.1