sdm660-common: light: Drop unnecessary handled variable in setLight()

This commit is contained in:
Paul Keith 2019-06-03 14:11:20 +02:00 committed by Max Weffers
parent 4b3dfd83e7
commit 16f37dbdcd
No known key found for this signature in database
GPG key ID: 795F73D22FB93FAE

View file

@ -195,7 +195,6 @@ namespace implementation {
Return<Status> Light::setLight(Type type, const LightState& state) { Return<Status> Light::setLight(Type type, const LightState& state) {
LightStateHandler handler = nullptr; LightStateHandler handler = nullptr;
bool handled = false;
/* Lock global mutex until light state is updated. */ /* Lock global mutex until light state is updated. */
std::lock_guard<std::mutex> lock(globalLock); std::lock_guard<std::mutex> lock(globalLock);
@ -217,15 +216,12 @@ Return<Status> Light::setLight(Type type, const LightState& state) {
for (LightBackend& backend : backends) { for (LightBackend& backend : backends) {
if (handler == backend.handler && isLit(backend.state)) { if (handler == backend.handler && isLit(backend.state)) {
handler(backend.state); handler(backend.state);
handled = true; return Status::SUCCESS;
break;
} }
} }
/* If no type has been lit up, then turn off the hardware. */ /* If no type has been lit up, then turn off the hardware. */
if (!handled) {
handler(state); handler(state);
}
return Status::SUCCESS; return Status::SUCCESS;
} }