sm6250-common: light: avoid uint32_t underflow
Change-Id: If4f9360cc301ee8ba9f432dbbe3379c2c634c574
This commit is contained in:
parent
f98970f590
commit
46157d8b5b
@ -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