From 089a16b6e8a1f4acb6e021b1aa0e49cfc8997810 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 25 Nov 2025 08:43:09 -0600 Subject: [PATCH] cpukit/dev/can/can-bus.c: Address type-limits warnings These changes were made to address GCC -Wtype-limits warnings. In this case, the variables were unsigned and there was no need to check them for being <= 0. Updates #5388. --- cpukit/dev/can/can-bus.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cpukit/dev/can/can-bus.c b/cpukit/dev/can/can-bus.c index d945b261d3..f01e075c0c 100644 --- a/cpukit/dev/can/can-bus.c +++ b/cpukit/dev/can/can-bus.c @@ -230,12 +230,12 @@ static int can_bus_ioctl_create_queue( return -EINVAL; } - /* Check whether correct dlen_max and buffer_size is to be set. */ - if ( - queue.dlen_max > CAN_FRAME_MAX_DLEN || - queue.dlen_max < 0 || - queue.buffer_size < 0 - ) { + /* + * Check whether correct dlen_max and buffer_size is to be set. + * Note that dlen_max and buffer_size are unsigned and do not need to + * be checked for < 0. + */ + if ( queue.dlen_max > CAN_FRAME_MAX_DLEN ) { return -EINVAL; } @@ -248,8 +248,11 @@ static int can_bus_ioctl_create_queue( queue.buffer_size = RTEMS_CAN_FIFO_SIZE; } - /* Check whether correct queue priority is to be set. */ - if ( queue.priority < 0 || queue.priority > RTEMS_CAN_QUEUE_PRIO_NR ) { + /* + * Check whether correct queue priority is to be set. + * Note that priority is unsigned and does not need to be checked for < 0. + */ + if ( queue.priority > RTEMS_CAN_QUEUE_PRIO_NR ) { return -EINVAL; }