diff options
author | Kan Liang <kan.liang@linux.intel.com> | 2021-06-24 21:17:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-25 15:36:17 +0300 |
commit | 7412c988fe123a064d67778611a5e40fd50bfd20 (patch) | |
tree | 28a16d5ed49f0cb346a65ff1ab07473cedf69091 /arch/x86 | |
parent | 892387e7619ecb339dd43c4ab916256d6c4c0001 (diff) | |
download | linux-7412c988fe123a064d67778611a5e40fd50bfd20.tar.xz |
perf/x86/intel/uncore: Clean up error handling path of iio mapping
[ Upstream commit d4ba0b06306a70c99a43f9d452886a86e2d3bd26 ]
The error handling path of iio mapping looks fragile. We already fixed
one issue caused by it, commit f797f05d917f ("perf/x86/intel/uncore:
Fix for iio mapping on Skylake Server"). Clean up the error handling
path and make the code robust.
Reported-by: gushengxian <gushengxian@yulong.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/40e66cf9-398b-20d7-ce4d-433be6e08921@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/events/intel/uncore_snbep.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index 16159950fcf5..9c936d06fb61 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3752,11 +3752,11 @@ static int skx_iio_set_mapping(struct intel_uncore_type *type) /* One more for NULL. */ attrs = kcalloc((uncore_max_dies() + 1), sizeof(*attrs), GFP_KERNEL); if (!attrs) - goto err; + goto clear_topology; eas = kcalloc(uncore_max_dies(), sizeof(*eas), GFP_KERNEL); if (!eas) - goto err; + goto clear_attrs; for (die = 0; die < uncore_max_dies(); die++) { sprintf(buf, "die%ld", die); @@ -3777,7 +3777,9 @@ err: for (; die >= 0; die--) kfree(eas[die].attr.attr.name); kfree(eas); +clear_attrs: kfree(attrs); +clear_topology: kfree(type->topology); clear_attr_update: type->attr_update = NULL; |