Skip to content

Commit c58c130

Browse files
XenuIsWatchingmmahadevan108
authored andcommitted
drivers: sensor: default_rtio_sensor: fix limited range warning
`chan_type` is defined as a `uint16_t`. This makes checking if it is < 0 always false. A warning is shown with -Wtype-limits. Remove the check as it is unnecessary. Signed-off-by: Ryan McClelland <[email protected]>
1 parent 04d8b7c commit c58c130

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/sensor/default_rtio_sensor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ int sensor_natively_supported_channel_size_info(struct sensor_chan_spec channel,
348348
__ASSERT_NO_MSG(base_size != NULL);
349349
__ASSERT_NO_MSG(frame_size != NULL);
350350

351-
if (((int)channel.chan_type < 0) || channel.chan_type >= (SENSOR_CHAN_ALL)) {
351+
if (channel.chan_type >= SENSOR_CHAN_ALL) {
352352
return -ENOTSUP;
353353
}
354354

@@ -474,7 +474,7 @@ static int decode(const uint8_t *buffer, struct sensor_chan_spec chan_spec,
474474
return -EINVAL;
475475
}
476476

477-
if (((int)chan_spec.chan_type < 0) || chan_spec.chan_type >= (SENSOR_CHAN_ALL)) {
477+
if (chan_spec.chan_type >= SENSOR_CHAN_ALL) {
478478
return 0;
479479
}
480480

0 commit comments

Comments
 (0)