davinci: light: Avoid uint32_t underflow
Change-Id: If4f9360cc301ee8ba9f432dbbe3379c2c634c574
This commit is contained in:
parent
e5440961f0
commit
feedda1d84
@ -74,6 +74,10 @@ static uint32_t getBrightness(const LightState& state) {
|
||||
}
|
||||
|
||||
static inline uint32_t scaleBrightness(uint32_t brightness, uint32_t maxBrightness) {
|
||||
if (brightness == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (brightness - 1) * (maxBrightness - 1) / (0xFF - 1) + 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user