target/riscv: fix use of uninitialized value
[fw/openocd] / src / target / riscv / asm.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #ifndef TARGET__RISCV__ASM_H
4 #define TARGET__RISCV__ASM_H
5
6 #include "riscv.h"
7
8 /*** Version-independent functions that we don't want in the main address space. ***/
9
10 static uint32_t load(const struct target *target, unsigned int rd,
11                 unsigned int base, uint16_t offset) __attribute__ ((unused));
12 static uint32_t load(const struct target *target, unsigned int rd,
13                 unsigned int base, uint16_t offset)
14 {
15         switch (riscv_xlen(target)) {
16                 case 32:
17                         return lw(rd, base, offset);
18                 case 64:
19                         return ld(rd, base, offset);
20         }
21         assert(0);
22         return 0; /* Silence -Werror=return-type */
23 }
24
25 static uint32_t store(const struct target *target, unsigned int src,
26                 unsigned int base, uint16_t offset) __attribute__ ((unused));
27 static uint32_t store(const struct target *target, unsigned int src,
28                 unsigned int base, uint16_t offset)
29 {
30         switch (riscv_xlen(target)) {
31                 case 32:
32                         return sw(src, base, offset);
33                 case 64:
34                         return sd(src, base, offset);
35         }
36         assert(0);
37         return 0; /* Silence -Werror=return-type */
38 }
39
40 #endif