# \[PATCH 4/8\] perf/amd/uncore: Use free\_percpu's built-in check for null

- From: Kim Phillips \<hidden\>
- Date: 2021-08-17 22:12:11 
- List: linux-perf-users
- Page: https://ratatoskr.run/linux-perf-users/2021/08/1480935
- Thread: https://ratatoskr.run/linux-perf-users/2021/08/1480931/t.md

```text
free_percpu() has its own check for null.

Signed-off-by: Kim Phillips <redacted>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrew Murray <redacted>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <redacted>
Cc: Joao Martins <redacted>
Cc: Konrad Rzeszutek Wilk <redacted>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <redacted>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <redacted>
Cc: Stephane Eranian <redacted>
Cc: Thomas Gleixner <redacted>
Cc: <redacted>
Cc: <redacted>
Cc: x86@kernel.org
---
 arch/x86/events/amd/uncore.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index 582c0ffb5e98..05bdb4cba300 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -659,11 +659,9 @@ static int __init amd_uncore_init(void)
 fail_llc:
 	if (boot_cpu_has(X86_FEATURE_PERFCTR_NB))
 		perf_pmu_unregister(&amd_nb_pmu);
-	if (amd_uncore_llc)
-		free_percpu(amd_uncore_llc);
+	free_percpu(amd_uncore_llc);
 fail_nb:
-	if (amd_uncore_nb)
-		free_percpu(amd_uncore_nb);
+	free_percpu(amd_uncore_nb);
 
 	return ret;
 }
-- 
2.31.1

```
