Skip to content

Commit

Permalink
drivers/sensors/gnss: Macro UINT8_MAX for maximum value of `uint8_t…
Browse files Browse the repository at this point in the history
… crefs`

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

Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 committed Jan 8, 2025
1 parent cd83dc1 commit 9004da9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/sensors/gnss_uorb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9004da9

Please sign in to comment.