xiaoxiang781216 commented on code in PR #7618: URL: https://github.com/apache/incubator-nuttx/pull/7618#discussion_r1028032609
########## mm/mm_gran/mm_granreserve.c: ########## @@ -54,13 +54,15 @@ * size - The size of the region to be reserved * * Returned Value: - * None + * On success, a non-NULL pointer to the allocated memory is returned; + * NULL is returned on failure. * ****************************************************************************/ -void gran_reserve(GRAN_HANDLE handle, uintptr_t start, size_t size) +FAR void *gran_reserve(GRAN_HANDLE handle, uintptr_t start, size_t size) { FAR struct gran_s *priv = (FAR struct gran_s *)handle; + FAR void *ret = (FAR void *)start; Review Comment: ```suggestion FAR void *ret = NULL; ``` ########## mm/shm/shmdt.c: ########## @@ -116,8 +115,7 @@ int shmdt(FAR const void *shmaddr) /* Free the virtual address space */ - gran_free(group->tg_shm.gs_handle, (FAR void *)shmaddr, - region->sr_ds.shm_segsz); + shm_free(group, (FAR void *)shmaddr, region->sr_ds.shm_segsz); Review Comment: remove the cast ########## mm/mm_gran/mm_pgalloc.c: ########## @@ -123,7 +123,7 @@ void mm_pginitialize(FAR void *heap_start, size_t heap_size) void mm_pgreserve(uintptr_t start, size_t size) { - gran_reserve(g_pgalloc, start, size); + DEBUGASSERT(gran_reserve(g_pgalloc, start, size) != NULL); Review Comment: you can't since DEBUGASSERT may become emtpy in release build. You need either removd the assertion or assign the returned value to a local var and assert the new variable instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org