You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2023/10/09 06:59:39 UTC
[mynewt-core] 01/07: hw/mcu/native: Fix hal_timer_get_resolution
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 16f2c7c323c5ccb0b89cccb0fc98aab18091ebf5
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Fri Oct 6 15:48:47 2023 +0200
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
---
hw/mcu/native/src/hal_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/mcu/native/src/hal_timer.c b/hw/mcu/native/src/hal_timer.c
index 77d3d0efe..59d091c9e 100644
--- a/hw/mcu/native/src/hal_timer.c
+++ b/hw/mcu/native/src/hal_timer.c
@@ -148,7 +148,7 @@ hal_timer_get_resolution(int num)
{
struct native_timer *nt;
- if (num >= 0) {
+ if (num != 0) {
return 0;
}
nt = &native_timers[num];