percpu: fix static checker warnings in pcpu_destroy_chunk

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]>
This commit is contained in:
Dennis Zhou 2017-06-29 10:56:26 -04:00 • committed by Tejun Heo
commit e3efe3db93
2 changed files with 8 additions and 2 deletions

View file

@ -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);
}