mirror of
https://github.com/PixelExperience-Devices/device_xiaomi_sm6250-common.git
synced 2025-07-01 07:19:53 +09:00
sm6250-common: light: avoid uint32_t underflow
Change-Id: If4f9360cc301ee8ba9f432dbbe3379c2c634c574
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user