Skip to content

Commit 646bf48

Browse files
Zhangshoukuixiaoxiang781216
authored andcommitted
shmfs: Assign a variable when object is not null
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
1 parent 20e03f5 commit 646bf48

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

fs/shm/shmfs_alloc.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,16 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length)
148148

149149
void shmfs_free_object(FAR struct shmfs_object_s *object)
150150
{
151-
#if defined(CONFIG_BUILD_KERNEL)
152-
size_t i;
153-
size_t n_pages = MM_NPAGES(object->length);
154-
FAR void **pages;
155-
#endif
156-
157151
if (object)
158152
{
159153
#if defined(CONFIG_BUILD_FLAT)
160154
fs_heap_free(object->paddr);
161155
#elif defined(CONFIG_BUILD_PROTECTED)
162156
kumm_free(object->paddr);
163157
#elif defined(CONFIG_BUILD_KERNEL)
164-
pages = &object->paddr;
158+
size_t i;
159+
size_t n_pages = MM_NPAGES(object->length);
160+
FAR void **pages = &object->paddr;
165161
for (i = 0; i < n_pages; i++)
166162
{
167163
if (pages[i])

0 commit comments

Comments
 (0)