This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 31a6ffa15ca4e1604f80a02646a73c16570b8cbb
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Mon Dec 18 23:31:20 2023 +0800

    arm/sama5: Fix error: array subscript 0 is outside array bounds
    
    chip/sam_emaca.c: In function 'sam_emac_interrupt':
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:140:25: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      140 | #define getreg32(a)    (*(volatile uint32_t *)(a))
          |                        ~^~~~~~~~~~~~~~~~~~~~~~~~~~
    chip/sam_emaca.c:364:37: note: in expansion of macro 'getreg32'
      364 | #  define sam_getreg(priv,addr)     getreg32(addr)
          |                                     ^~~~~~~~
    chip/sam_emaca.c:1630:9: note: in expansion of macro 'sam_getreg'
     1630 |   tsr = sam_getreg(priv, SAM_EMAC_TSR_OFFSET);
          |         ^~~~~~~~~~
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 arch/arm/src/sama5/sam_emaca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c
index e5fb8c1454..c1f0e6577f 100644
--- a/arch/arm/src/sama5/sam_emaca.c
+++ b/arch/arm/src/sama5/sam_emaca.c
@@ -1627,7 +1627,7 @@ static int sam_emac_interrupt(int irq, void *context, 
void *arg)
    *   a one to this bit.
    */
 
-  tsr = sam_getreg(priv, SAM_EMAC_TSR_OFFSET);
+  tsr = sam_getreg(priv, SAM_EMAC_TSR);
   if ((tsr & EMAC_TSR_COMP) != 0)
     {
       /* If a TX transfer just completed, then cancel the TX timeout so

Reply via email to