From 8282ed9ab0fcd64da1a27ad0d1f1157df9fcf8c1 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Wed, 8 Jan 2025 18:22:12 +0800 Subject: [PATCH] drivers/sensors/gnss: Macro `UINT8_MAX` for maximum value of `uint8_t crefs` libs/libc/gnssutils/minmea/minmea.h:17:#include Signed-off-by: wangjianyu3 --- drivers/sensors/gnss_uorb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/sensors/gnss_uorb.c b/drivers/sensors/gnss_uorb.c index 257543e88e..1567fb00e0 100644 --- a/drivers/sensors/gnss_uorb.c +++ b/drivers/sensors/gnss_uorb.c @@ -168,7 +168,8 @@ static int gnss_activate(FAR struct sensor_lowerhalf_s *lower, int ret = OK; 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; } @@ -233,7 +234,7 @@ static int gnss_open(FAR struct file *filep) } nxmutex_lock(&upper->lock); - if (upper->crefs >= 255) + if (upper->crefs >= UINT8_MAX) { ret = -EMFILE; kmm_free(user);