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 d54c79126a8c03ec40dbae55180ae3cec52c7416
Author: Xiang Xiao <[email protected]>
AuthorDate: Mon Dec 18 21:32:54 2023 +0800

    am335x_lcdc: Fix error: array subscript 0 is outside array bounds of 
'volatile uint32_t[0]'
    
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:51: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
          |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
    chip/am335x_lcdc.c:387:3: note: in expansion of macro 'putreg32'
      387 |   putreg32(AM335X_CM_WKUP_CLKMODE_DPLL_DISP, 0x4);
          |   ^~~~~~~~
    In function 'am335x_lcd_initialize':
    cc1: note: source object is likely at address zero
    In function 'am335x_set_refclk',
        inlined from 'am335x_lcd_initialize' at chip/am335x_lcdc.c:607:9:
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:51: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
          |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
    chip/am335x_lcdc.c:430:3: note: in expansion of macro 'putreg32'
      430 |   putreg32(AM335X_CM_WKUP_CLKMODE_DPLL_DISP, 0x7);
          |   ^~~~~~~~
    In function 'am335x_lcd_initialize':
    cc1: note: source object is likely at address zero
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    chip/am335x_lcdc.c:780:3: note: in expansion of macro 'putreg32'
      780 |   putreg32(AM335X_LCD_CLKC_ENABLE,
          |   ^~~~~~~~
    cc1: note: source object is likely at address zero
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    chip/am335x_lcdc.c:784:3: note: in expansion of macro 'putreg32'
      784 |   putreg32(AM335X_LCD_CLKC_RESET, LCD_CLKC_RESET_MAIN);
          |   ^~~~~~~~
    cc1: note: source object is likely at address zero
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    chip/am335x_lcdc.c:790:3: note: in expansion of macro 'putreg32'
      790 |   putreg32(AM335X_LCD_IRQ_EN_SET, regval);
          |   ^~~~~~~~
    cc1: note: source object is likely at address zero
    Error: 
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:141:25: 
error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 
'volatile long unsigned int[]'} [-Werror=array-bounds=]
      141 | #define putreg32(v,a)  (*(volatile uint32_t *)(a) = (v))
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    chip/am335x_lcdc.c:796:3: note: in expansion of macro 'putreg32'
      796 |   putreg32(AM335X_LCD_SYSC, LCD_SYSC_IDLE_SMART | 
LCD_SYSC_STANDBY_SMART);
          |   ^~~~~~~~
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 arch/arm/src/am335x/am335x_lcdc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/arm/src/am335x/am335x_lcdc.c 
b/arch/arm/src/am335x/am335x_lcdc.c
index be8e5e64c9..5e9608450e 100644
--- a/arch/arm/src/am335x/am335x_lcdc.c
+++ b/arch/arm/src/am335x/am335x_lcdc.c
@@ -384,7 +384,7 @@ static int am335x_set_refclk(uint32_t frequency)
 
   /* Bypass mode */
 
-  putreg32(AM335X_CM_WKUP_CLKMODE_DPLL_DISP, 0x4);
+  putreg32(0x4, AM335X_CM_WKUP_CLKMODE_DPLL_DISP);
 
   /* Make sure it's in bypass mode */
 
@@ -427,7 +427,7 @@ static int am335x_set_refclk(uint32_t frequency)
 
   /* Locked mode */
 
-  putreg32(AM335X_CM_WKUP_CLKMODE_DPLL_DISP, 0x7);
+  putreg32(0x7, AM335X_CM_WKUP_CLKMODE_DPLL_DISP);
 
   timeout = 10000;
   while ((getreg32(AM335X_CM_WKUP_IDLEST_DPLL_DISP) & (1 << 0)) == 0 &&
@@ -777,23 +777,22 @@ int am335x_lcd_initialize(const struct 
am335x_panel_info_s *panel)
 
   putreg32(AM335X_LCD_RASTER_CTRL, regval);
 
-  putreg32(AM335X_LCD_CLKC_ENABLE,
-           LCD_CLKC_ENABLE_CORE | LCD_CLKC_ENABLE_LIDD |
-           LCD_CLKC_ENABLE_DMA);
+  putreg32(LCD_CLKC_ENABLE_CORE | LCD_CLKC_ENABLE_LIDD |
+           LCD_CLKC_ENABLE_DMA, AM335X_LCD_CLKC_ENABLE);
 
-  putreg32(AM335X_LCD_CLKC_RESET, LCD_CLKC_RESET_MAIN);
+  putreg32(LCD_CLKC_RESET_MAIN, AM335X_LCD_CLKC_RESET);
   up_udelay(100);
-  putreg32(AM335X_LCD_CLKC_RESET, 0);
+  putreg32(0, AM335X_LCD_CLKC_RESET);
 
   regval  = LCD_IRQ_DONE | LCD_IRQ_RR_DONE | LCD_IRQ_SYNC | LCD_IRQ_ACB |
            LCD_IRQ_PL | LCD_IRQ_FUF | LCD_IRQ_EOF0 | LCD_IRQ_EOF1;
-  putreg32(AM335X_LCD_IRQ_EN_SET, regval);
+  putreg32(regval, AM335X_LCD_IRQ_EN_SET);
 
   regval  = getreg32(AM335X_LCD_RASTER_CTRL);
   regval |= LCD_RASTER_CTRL_LCD_EN;
   putreg32(AM335X_LCD_RASTER_CTRL, regval);
 
-  putreg32(AM335X_LCD_SYSC, LCD_SYSC_IDLE_SMART | LCD_SYSC_STANDBY_SMART);
+  putreg32(LCD_SYSC_IDLE_SMART | LCD_SYSC_STANDBY_SMART, AM335X_LCD_SYSC);
 
 #ifdef CONFIG_AM335X_LCDC_BACKLIGHT
   /* Turn on the back light

Reply via email to