hw/mcu/native: Fix hal_timer_get_resolution
| Error: repos/apache-mynewt-core/hw/mcu/native/src/hal_timer.c:
In function ‘hal_timer_get_resolution’:
| repos/apache-mynewt-core/hw/mcu/native/src/hal_timer.c:154:24:
error: array subscript -1 is below array bounds of
‘struct native_timer[1]’ [-Werror=array-bounds]
| 154 | nt = &native_timers[num];
| | ~~~~~~~~~~~~~^~~~~
| repos/apache-mynewt-core/hw/mcu/native/src/hal_timer.c:41:3:
note: while referencing ‘native_timers’
| 41 | } native_timers[1];
| | ^~~~~~~~~~~~~
| cc1: all warnings being treated as errors
diff --git a/hw/mcu/native/src/hal_timer.c b/hw/mcu/native/src/hal_timer.c
index 77d3d0e..59d091c 100644
--- a/hw/mcu/native/src/hal_timer.c
+++ b/hw/mcu/native/src/hal_timer.c
@@ -148,7 +148,7 @@
{
struct native_timer *nt;
- if (num >= 0) {
+ if (num != 0) {
return 0;
}
nt = &native_timers[num];