Skip to content

Commit 3ad2b06

Browse files
Flavio Ceolinnashif
Flavio Ceolin
authored andcommitted
device: Fix device from handle function
This function was returning NULL for the last handle because of a wrong comparison. Signed-off-by: Flavio Ceolin <[email protected]>
1 parent 8580f63 commit 3ad2b06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ device_from_handle(device_handle_t dev_handle)
431431
const struct device *dev = NULL;
432432
size_t numdev = __device_end - __device_start;
433433

434-
if ((dev_handle > 0) && ((size_t)dev_handle < numdev)) {
434+
if ((dev_handle > 0) && ((size_t)dev_handle <= numdev)) {
435435
dev = &__device_start[dev_handle - 1];
436436
}
437437

0 commit comments

Comments
 (0)