drivers/sensors/gnss: Macro UINT8_MAX for maximum value of uint8_t crefs

libs/libc/gnssutils/minmea/minmea.h:17:#include <stdint.h>

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2025-01-08 18:22:12 +08:00 committed by Xiang Xiao
parent 428c2bfb91
commit 8282ed9ab0

View file

@ -168,7 +168,8 @@ static int gnss_activate(FAR struct sensor_lowerhalf_s *lower,
int ret = OK; int ret = OK;
nxmutex_lock(&upper->lock); nxmutex_lock(&upper->lock);
if ((upper->crefs == 255 && enable) || (upper->crefs == 0 && !enable)) if ((upper->crefs == UINT8_MAX && enable) ||
(upper->crefs == 0 && !enable))
{ {
ret = -EINVAL; ret = -EINVAL;
} }
@ -233,7 +234,7 @@ static int gnss_open(FAR struct file *filep)
} }
nxmutex_lock(&upper->lock); nxmutex_lock(&upper->lock);
if (upper->crefs >= 255) if (upper->crefs >= UINT8_MAX)
{ {
ret = -EMFILE; ret = -EMFILE;
kmm_free(user); kmm_free(user);