summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJukka Laitinen <[email protected]>2022-01-19 11:20:17 +0200
committerAnup Patel <[email protected]>2022-01-21 21:58:12 +0530
commit5d025eb2353550eadbd2fa9b8083a92fe9b07bd9 (patch)
treed894553a47e62e5224780e2836a4648bc778c9e8 /include
parentfb688d9e9d4099d6945c9e460b9cd2c8c4d8a29b (diff)
lib: fix pointer of type 'void *' used in arithmetic
Using "void *" in arithmetic causes errors with strict compiler settings: "error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]" Avoid these by calculating on "char *" where 1-byte data size is assumed. Signed-off-by: Jukka Laitinen <[email protected]> Reviewed-by: Dong Du <[email protected]> Reviewed-by: Xiang W <[email protected]> Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_scratch.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
index 186a40c8..0c273076 100644
--- a/include/sbi/sbi_scratch.h
+++ b/include/sbi/sbi_scratch.h
@@ -104,11 +104,11 @@ unsigned long sbi_scratch_alloc_offset(unsigned long size);
void sbi_scratch_free_offset(unsigned long offset);
/** Get pointer from offset in sbi_scratch */
-#define sbi_scratch_offset_ptr(scratch, offset) ((void *)scratch + (offset))
+#define sbi_scratch_offset_ptr(scratch, offset) (void *)((char *)(scratch) + (offset))
/** Get pointer from offset in sbi_scratch for current HART */
#define sbi_scratch_thishart_offset_ptr(offset) \
- ((void *)sbi_scratch_thishart_ptr() + (offset))
+ (void *)((char *)sbi_scratch_thishart_ptr() + (offset))
/** HART id to scratch table */
extern struct sbi_scratch *hartid_to_scratch_table[];