Skip to content

Commit 1f49de2

Browse files
committed
[quality] remove void-arith
1 parent 2fa5e9e commit 1f49de2

File tree

10 files changed

+70
-66
lines changed

10 files changed

+70
-66
lines changed

components/lwp/lwp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ static void _lwp_thread_entry(void *parameter)
11131113
rt_hw_icache_invalidate_all();
11141114

11151115
#ifdef ARCH_MM_MMU
1116-
arch_start_umode(lwp->args, lwp->text_entry, (void *)USER_STACK_VEND, tid->stack_addr + tid->stack_size);
1116+
arch_start_umode(lwp->args, lwp->text_entry, (void *)USER_STACK_VEND, (char *)tid->stack_addr + tid->stack_size);
11171117
#else
11181118
arch_start_umode(lwp->args, lwp->text_entry, lwp->data_entry, (void *)((uint32_t)lwp->data_entry + lwp->data_size));
11191119
#endif /* ARCH_MM_MMU */

components/lwp/lwp_shm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void on_shm_page_fault(struct rt_varea *varea, struct rt_aspace_fault_msg
6363

6464
/* map all share page frames to user space in a time */
6565
void *page = (void *)shm->addr;
66-
void *pg_paddr = page + PV_OFFSET;
66+
void *pg_paddr = (char *)page + PV_OFFSET;
6767
err = rt_varea_map_range(varea, varea->start, pg_paddr, shm->size);
6868

6969
if (err == RT_EOK)

components/lwp/lwp_syscall.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static void _crt_thread_entry(void *parameter)
306306
user_stack &= ~7; //align 8
307307

308308
#ifdef ARCH_MM_MMU
309-
arch_crt_start_umode(parameter, tid->user_entry, (void *)user_stack, tid->stack_addr + tid->stack_size);
309+
arch_crt_start_umode(parameter, tid->user_entry, (void *)user_stack, (char *)tid->stack_addr + tid->stack_size);
310310
#else
311311
set_user_context((void*)user_stack);
312312
arch_start_umode(parameter, tid->user_entry, ((struct rt_lwp *)tid->lwp)->data_entry, (void*)user_stack);
@@ -2396,7 +2396,7 @@ sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
23962396
arch_start_umode(lwp->args,
23972397
lwp->text_entry,
23982398
(void*)USER_STACK_VEND,
2399-
thread->stack_addr + thread->stack_size);
2399+
(char *)thread->stack_addr + thread->stack_size);
24002400
/* never reach here */
24012401
}
24022402
return -EINVAL;

components/lwp/lwp_user_mm.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void _user_do_page_fault(struct rt_varea *varea,
123123

124124
if (lwp_objs->source)
125125
{
126-
void *paddr = rt_hw_mmu_v2p(lwp_objs->source, msg->fault_vaddr);
126+
char *paddr = rt_hw_mmu_v2p(lwp_objs->source, msg->fault_vaddr);
127127
if (paddr != ARCH_MAP_FAILED)
128128
{
129129
void *vaddr;
@@ -221,9 +221,9 @@ int lwp_unmap_user(struct rt_lwp *lwp, void *va)
221221
static void _dup_varea(rt_varea_t varea, struct rt_lwp *src_lwp,
222222
rt_aspace_t dst)
223223
{
224-
void *vaddr = varea->start;
225-
void *vend = vaddr + varea->size;
226-
if (vaddr < (void *)USER_STACK_VSTART || vaddr >= (void *)USER_STACK_VEND)
224+
char *vaddr = varea->start;
225+
char *vend = vaddr + varea->size;
226+
if (vaddr < (char *)USER_STACK_VSTART || vaddr >= (char *)USER_STACK_VEND)
227227
{
228228
while (vaddr != vend)
229229
{
@@ -431,7 +431,7 @@ void *lwp_map_user_phy(struct rt_lwp *lwp, void *map_va, void *map_pa,
431431
size_t map_size, int cached)
432432
{
433433
int err;
434-
void *va;
434+
char *va;
435435
size_t offset = 0;
436436

437437
if (!map_size)
@@ -459,7 +459,7 @@ void *lwp_map_user_phy(struct rt_lwp *lwp, void *map_va, void *map_pa,
459459
rt_size_t attr = cached ? MMU_MAP_U_RWCB : MMU_MAP_U_RW;
460460

461461
err =
462-
rt_aspace_map_phy(lwp->aspace, &hint, attr, MM_PA_TO_OFF(map_pa), &va);
462+
rt_aspace_map_phy(lwp->aspace, &hint, attr, MM_PA_TO_OFF(map_pa), (void **)&va);
463463
if (err != RT_EOK)
464464
{
465465
va = RT_NULL;

components/mm/avl_adpt.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static struct rt_varea *search(struct util_avl_root *root,
7878
{
7979
rt_varea_t varea = VAREA_ENTRY(node);
8080
int cmp = compare(range.start, range.end, varea->start,
81-
varea->start + varea->size - 1);
81+
(char *)varea->start + varea->size - 1);
8282

8383
if (cmp < 0)
8484
{
@@ -118,7 +118,7 @@ rt_varea_t _aspace_bst_search_exceed(struct rt_aspace *aspace, void *start)
118118
if (cmp < 0)
119119
{
120120
/* varae exceed start */
121-
ptrdiff_t off = va_s - start;
121+
ptrdiff_t off = (char *)va_s - (char *)start;
122122
if (off < min_off)
123123
{
124124
min_off = off;

components/mm/ioremap.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ enum ioremap_type
3333

3434
static void *_ioremap_type(void *paddr, size_t size, enum ioremap_type type)
3535
{
36-
void *v_addr = NULL;
36+
char *v_addr = NULL;
3737
size_t attr;
3838
size_t lo_off;
3939
int err;
4040

41-
lo_off = (uintptr_t)paddr & ARCH_PAGE_MASK;
41+
lo_off = (rt_ubase_t)paddr & ARCH_PAGE_MASK;
4242

4343
struct rt_mm_va_hint hint = {
4444
.prefer = RT_NULL,
@@ -62,7 +62,7 @@ static void *_ioremap_type(void *paddr, size_t size, enum ioremap_type type)
6262
default:
6363
return v_addr;
6464
}
65-
err = rt_aspace_map_phy(&rt_kernel_space, &hint, attr, MM_PA_TO_OFF(paddr), &v_addr);
65+
err = rt_aspace_map_phy(&rt_kernel_space, &hint, attr, MM_PA_TO_OFF(paddr), (void **)&v_addr);
6666

6767
if (err)
6868
{

components/mm/mm_object.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ void rt_varea_pgmgr_pop_all(rt_varea_t varea)
5656

5757
void rt_varea_pgmgr_pop(rt_varea_t varea, void *vaddr, rt_size_t size)
5858
{
59-
void *vend = vaddr + size;
59+
void *vend = (char *)vaddr + size;
6060
while (vaddr != vend)
6161
{
6262
rt_page_t page = rt_page_addr2page(vaddr);
6363
page->pre->next = page->next;
6464
page->next->pre = page->pre;
6565
rt_pages_free(vaddr, 0);
66-
vaddr += ARCH_PAGE_SIZE;
66+
vaddr = (char *)vaddr + ARCH_PAGE_SIZE;
6767
}
6868
}
6969

components/mm/mm_page.c

+23-23
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ static void hint_free(rt_mm_va_hint_t hint)
6363

6464
static void on_page_fault(struct rt_varea *varea, struct rt_aspace_fault_msg *msg)
6565
{
66-
void *init_start = (void *)init_mpr_align_start;
67-
void *init_end = (void *)init_mpr_align_end;
68-
if (msg->fault_vaddr < init_end && msg->fault_vaddr >= init_start)
66+
char *init_start = (void *)init_mpr_align_start;
67+
char *init_end = (void *)init_mpr_align_end;
68+
if ((char *)msg->fault_vaddr < init_end && (char *)msg->fault_vaddr >= init_start)
6969
{
70-
rt_size_t offset = msg->fault_vaddr - init_start;
70+
rt_size_t offset = (char *)msg->fault_vaddr - init_start;
7171
msg->response.status = MM_FAULT_STATUS_OK;
72-
msg->response.vaddr = init_mpr_cont_start + offset;
72+
msg->response.vaddr = (char *)init_mpr_cont_start + offset;
7373
msg->response.size = ARCH_PAGE_SIZE;
7474
}
7575
else
@@ -194,13 +194,13 @@ static void _trace_free(rt_page_t page, void *caller, size_t size_bits)
194194

195195
static inline void *page_to_addr(rt_page_t page)
196196
{
197-
return (void *)((page - page_start) << ARCH_PAGE_SHIFT) - PV_OFFSET;
197+
return (void *)(((page - page_start) << ARCH_PAGE_SHIFT) - PV_OFFSET);
198198
}
199199

200200
static inline rt_page_t addr_to_page(rt_page_t pg_start, void *addr)
201201
{
202-
addr += PV_OFFSET;
203-
return &pg_start[((uintptr_t)addr >> ARCH_PAGE_SHIFT)];
202+
addr = (char *)addr + PV_OFFSET;
203+
return &pg_start[((rt_ubase_t)addr >> ARCH_PAGE_SHIFT)];
204204
}
205205

206206
#define FLOOR(val, align) (((rt_size_t)(val) + (align)-1) & ~((align)-1))
@@ -301,7 +301,7 @@ static void _pages_ref_inc(struct rt_page *p, rt_uint32_t size_bits)
301301
idx = idx & ~((1UL << size_bits) - 1);
302302

303303
page_head = page_start + idx;
304-
page_head = (void *)page_head + early_offset;
304+
page_head = (void *)((char *)page_head + early_offset);
305305
page_head->ref_cnt++;
306306
}
307307

@@ -324,7 +324,7 @@ static int _pages_free(rt_page_t page_list[], struct rt_page *p, rt_uint32_t siz
324324
struct rt_page *buddy;
325325

326326
RT_ASSERT(p >= page_start);
327-
RT_ASSERT((void *)p < rt_mpr_start + rt_mpr_size);
327+
RT_ASSERT((char *)p < (char *)rt_mpr_start + rt_mpr_size);
328328
RT_ASSERT(rt_kmem_v2p(p));
329329
RT_ASSERT(p->ref_cnt > 0);
330330
RT_ASSERT(p->size_bits == ARCH_ADDRESS_WIDTH_BITS);
@@ -395,10 +395,10 @@ static struct rt_page *_pages_alloc(rt_page_t page_list[], rt_uint32_t size_bits
395395

396396
static void _early_page_remove(rt_page_t page_list[], rt_page_t page, rt_uint32_t size_bits)
397397
{
398-
rt_page_t page_cont = (void *)page + early_offset;
398+
rt_page_t page_cont = (rt_page_t)((char *)page + early_offset);
399399
if (page_cont->pre)
400400
{
401-
rt_page_t pre_cont = (void *)page_cont->pre + early_offset;
401+
rt_page_t pre_cont = (rt_page_t)((char *)page_cont->pre + early_offset);
402402
pre_cont->next = page_cont->next;
403403
}
404404
else
@@ -408,7 +408,7 @@ static void _early_page_remove(rt_page_t page_list[], rt_page_t page, rt_uint32_
408408

409409
if (page_cont->next)
410410
{
411-
rt_page_t next_cont = (void *)page_cont->next + early_offset;
411+
rt_page_t next_cont = (rt_page_t)((char *)page_cont->next + early_offset);
412412
next_cont->pre = page_cont->pre;
413413
}
414414

@@ -418,13 +418,13 @@ static void _early_page_remove(rt_page_t page_list[], rt_page_t page, rt_uint32_
418418
static void _early_page_insert(rt_page_t page_list[], rt_page_t page, int size_bits)
419419
{
420420
RT_ASSERT((void *)page >= rt_mpr_start &&
421-
(void *)page - rt_mpr_start < +rt_mpr_size);
422-
rt_page_t page_cont = (void *)page + early_offset;
421+
((char *)page - (char *)rt_mpr_start) < rt_mpr_size);
422+
rt_page_t page_cont = (rt_page_t)((char *)page + early_offset);
423423

424424
page_cont->next = page_list[size_bits];
425425
if (page_cont->next)
426426
{
427-
rt_page_t next_cont = (void *)page_cont->next + early_offset;
427+
rt_page_t next_cont = (rt_page_t)((char *)page_cont->next + early_offset);
428428
next_cont->pre = page;
429429
}
430430
page_cont->pre = 0;
@@ -466,7 +466,7 @@ static struct rt_page *_early_pages_alloc(rt_page_t page_list[], rt_uint32_t siz
466466
level--;
467467
}
468468
}
469-
rt_page_t page_cont = (void *)p + early_offset;
469+
rt_page_t page_cont = (rt_page_t)((char *)p + early_offset);
470470
page_cont->size_bits = ARCH_ADDRESS_WIDTH_BITS;
471471
page_cont->ref_cnt = 1;
472472
return p;
@@ -723,7 +723,7 @@ static void _install_page(rt_page_t mpr_head, rt_region_t region, void *insert_h
723723

724724
/* insert to list */
725725
rt_page_t *page_list = _get_page_list((void *)region.start);
726-
insert(page_list, (void *)p - early_offset, size_bits - ARCH_PAGE_SHIFT);
726+
insert(page_list, (rt_page_t)((char *)p - early_offset), size_bits - ARCH_PAGE_SHIFT);
727727
region.start += (1UL << size_bits);
728728
}
729729
}
@@ -778,9 +778,9 @@ void rt_page_init(rt_region_t reg)
778778
rt_size_t init_mpr_npage = init_mpr_size >> ARCH_PAGE_SHIFT;
779779

780780
init_mpr_cont_start = (void *)reg.start;
781-
void *init_mpr_cont_end = init_mpr_cont_start + init_mpr_size;
782-
early_offset = init_mpr_cont_start - (void *)init_mpr_align_start;
783-
rt_page_t mpr_cont = rt_mpr_start + early_offset;
781+
rt_size_t init_mpr_cont_end = (rt_size_t)init_mpr_cont_start + init_mpr_size;
782+
early_offset = (rt_size_t)init_mpr_cont_start - init_mpr_align_start;
783+
rt_page_t mpr_cont = (void *)((char *)rt_mpr_start + early_offset);
784784

785785
/* mark init mpr pages as illegal */
786786
rt_page_t head_cont = addr_to_page(mpr_cont, (void *)reg.start);
@@ -790,7 +790,7 @@ void rt_page_init(rt_region_t reg)
790790
iter->size_bits = ARCH_ADDRESS_WIDTH_BITS;
791791
}
792792

793-
reg.start = (rt_size_t)init_mpr_cont_end;
793+
reg.start = init_mpr_cont_end;
794794
_install_page(mpr_cont, reg, _early_page_insert);
795795

796796
pages_alloc_handler = _early_pages_alloc;
@@ -808,7 +808,7 @@ void rt_page_init(rt_region_t reg)
808808
static int _load_mpr_area(void *head, void *tail)
809809
{
810810
int err = 0;
811-
void *iter = (void *)((uintptr_t)head & ~ARCH_PAGE_MASK);
811+
char *iter = (char *)((rt_ubase_t)head & ~ARCH_PAGE_MASK);
812812
tail = (void *)FLOOR(tail, ARCH_PAGE_SIZE);
813813

814814
while (iter != tail)

libcpu/aarch64/common/cpu.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ static rt_uint64_t _read_be_number(void *start, int size)
132132
{
133133
rt_uint64_t buf = 0;
134134
for (; size > 0; size--)
135-
buf = (buf << 32) | fdt32_to_cpu(*(uint32_t *)start++);
135+
{
136+
buf = (buf << 32) | fdt32_to_cpu(*(uint32_t *)start);
137+
start = (uint32_t *)start + 1;
138+
}
136139
return buf;
137140
}
138141

0 commit comments

Comments
 (0)