src/jtag/drivers/ep93xx: fix GCC 12 warning
[fw/openocd] / src / jtag / drivers / ep93xx.c
index e7c993b3bc7945af076cee7e02c53ee67eabe519..5130bd4228f5535656d87b391d31d1e1d212089f 100644 (file)
@@ -24,7 +24,7 @@
 
 static uint8_t output_value;
 static int dev_mem_fd;
-static void *gpio_controller;
+static uint8_t *gpio_controller;
 static volatile uint8_t *gpio_data_register;
 static volatile uint8_t *gpio_data_direction_register;
 
@@ -110,19 +110,16 @@ static int ep93xx_reset(int trst, int srst)
 
 static int set_gonk_mode(void)
 {
-       void *syscon;
-       uint32_t devicecfg;
-
-       syscon = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
+       void *syscon = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
                        MAP_SHARED, dev_mem_fd, 0x80930000);
        if (syscon == MAP_FAILED) {
                LOG_ERROR("mmap: %s", strerror(errno));
                return ERROR_JTAG_INIT_FAILED;
        }
 
-       devicecfg = *((volatile int *)(syscon + 0x80));
-       *((volatile int *)(syscon + 0xc0)) = 0xaa;
-       *((volatile int *)(syscon + 0x80)) = devicecfg | 0x08000000;
+       uint32_t devicecfg = *((volatile uint32_t *)((uintptr_t)syscon + 0x80));
+       *((volatile uint32_t *)((uintptr_t)syscon + 0xc0)) = 0xaa;
+       *((volatile uint32_t *)((uintptr_t)syscon + 0x80)) = devicecfg | 0x08000000;
 
        munmap(syscon, 4096);