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

Change-Id: If6e76671cc1860102a5da6502338cda138dad3ee
This commit is contained in:
Paul Keith 2019-06-03 14:11:20 +02:00 committed by OdSazib
parent 9e4356c1f2
commit a2e190f5a2
No known key found for this signature in database
GPG key ID: CB336514F9F5CF69

View file

@ -224,7 +224,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);
@ -246,15 +245,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;
} }