xiaoxiang781216 commented on code in PR #14524:
URL: https://github.com/apache/nuttx/pull/14524#discussion_r1818716725
##########
fs/shm/shmfs.c:
##########
@@ -387,11 +387,19 @@ static int shmfs_unmap_area(FAR struct task_group_s
*group,
/* Unmap the memory from user virtual address space */
ret = up_shmdt((uintptr_t)vaddr, npages);
+ if (ret < 0)
+ {
+ return ret;
+ }
- /* Add the virtual memory back to the shared memory pool */
+ /* Free the virtual address space */
vm_release_region(get_group_mm(group), vaddr, length);
}
+ else
+ {
+ return -EINVAL;
Review Comment:
merge with line 376, and removd else block
##########
fs/shm/shmfs_alloc.c:
##########
@@ -148,20 +148,16 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t
length)
void shmfs_free_object(FAR struct shmfs_object_s *object)
{
-#if defined(CONFIG_BUILD_KERNEL)
- size_t i;
- size_t n_pages = MM_NPAGES(object->length);
- FAR void **pages;
-#endif
-
if (object)
{
#if defined(CONFIG_BUILD_FLAT)
fs_heap_free(object->paddr);
#elif defined(CONFIG_BUILD_PROTECTED)
kumm_free(object->paddr);
#elif defined(CONFIG_BUILD_KERNEL)
- pages = &object->paddr;
+ size_t i;
Review Comment:
move before line 153
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]