Skip to content

Commit

Permalink
percpu: fix static checker warnings in pcpu_destroy_chunk
Browse files Browse the repository at this point in the history
From 5021b97f4026334d2c8dfad80797dd1028cddd73 Mon Sep 17 00:00:00 2001
From: Dennis Zhou <[email protected]>
Date: Thu, 29 Jun 2017 07:11:41 -0700

Add NULL check in pcpu_destroy_chunk to correct static checker warnings.

Signed-off-by: Dennis Zhou <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
dennisszhou authored and htejun committed Jun 29, 2017
1 parent 303abfd commit e3efe3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mm/percpu-km.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ static void pcpu_destroy_chunk(struct pcpu_chunk *chunk)
{
const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT;

if (!chunk)
return;

pcpu_stats_chunk_dealloc();
trace_percpu_destroy_chunk(chunk->base_addr);

if (chunk && chunk->data)
if (chunk->data)
__free_pages(chunk->data, order_base_2(nr_pages));
pcpu_free_chunk(chunk);
}
Expand Down
5 changes: 4 additions & 1 deletion mm/percpu-vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,13 @@ static struct pcpu_chunk *pcpu_create_chunk(void)

static void pcpu_destroy_chunk(struct pcpu_chunk *chunk)
{
if (!chunk)
return;

pcpu_stats_chunk_dealloc();
trace_percpu_destroy_chunk(chunk->base_addr);

if (chunk && chunk->data)
if (chunk->data)
pcpu_free_vm_areas(chunk->data, pcpu_nr_groups);
pcpu_free_chunk(chunk);
}
Expand Down

0 comments on commit e3efe3d

Please sign in to comment.