From e3efe3db932b55ed34ba32862f568abae32046d0 Mon Sep 17 00:00:00 2001 From: Dennis Zhou Date: Thu, 29 Jun 2017 10:56:26 -0400 Subject: percpu: fix static checker warnings in pcpu_destroy_chunk From 5021b97f4026334d2c8dfad80797dd1028cddd73 Mon Sep 17 00:00:00 2001 From: Dennis Zhou 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 Reported-by: Dan Carpenter Signed-off-by: Tejun Heo --- mm/percpu-km.c | 5 ++++- mm/percpu-vm.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'mm') diff --git a/mm/percpu-km.c b/mm/percpu-km.c index 2b79e43c626f..eb58aa4c0997 100644 --- a/mm/percpu-km.c +++ b/mm/percpu-km.c @@ -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); } diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c index 7ad9d94bf547..15dab691ea70 100644 --- a/mm/percpu-vm.c +++ b/mm/percpu-vm.c @@ -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); } -- cgit v1.2.3