libcamera: controls: Suppress error message from ControlList::get()

Now that ControlList::get() returns a std::optional<T> to handle missing
controls, the error log message in the call to ControlList::find() is
unnecessary and likely invalid.

Fix this by avoiding the call to ControlList::find() from
ControlList::get() and replacing with a call to the underlying
std::unordered_map::find().

Fixes: 1c4d480185 ("libcamera: controls: Use std::optional to handle invalid control values")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2022-07-20 09:15:34 +01:00 committed by Laurent Pinchart
parent 4d22621ec1
commit 8b02645845

View file

@ -375,11 +375,12 @@ public:
template<typename T> template<typename T>
std::optional<T> get(const Control<T> &ctrl) const std::optional<T> get(const Control<T> &ctrl) const
{ {
const ControlValue *val = find(ctrl.id()); const auto entry = controls_.find(ctrl.id());
if (!val) if (entry == controls_.end())
return std::nullopt; return std::nullopt;
return val->get<T>(); const ControlValue &val = entry->second;
return val.get<T>();
} }
template<typename T, typename V> template<typename T, typename V>