All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] perf/x86/intel/pt: cleanup error handling in pt_pmu_hw_init()
@ 2015-04-09  9:08 Dan Carpenter
  2015-04-09 12:02 ` Ingo Molnar
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Dan Carpenter @ 2015-04-09  9:08 UTC (permalink / raw)
  To: kernel-janitors

There is no need to free NULL pointers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c
index f5a3afc..c358877 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_pt.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c
@@ -135,12 +135,12 @@ static int __init pt_pmu_hw_init(void)
 	size = sizeof(struct attribute *) * (ARRAY_SIZE(pt_caps) + 1);
 	attrs = kzalloc(size, GFP_KERNEL);
 	if (!attrs)
-		goto err_attrs;
+		return -ENOMEM;
 
 	size = sizeof(struct dev_ext_attribute) * (ARRAY_SIZE(pt_caps) + 1);
 	de_attrs = kzalloc(size, GFP_KERNEL);
 	if (!de_attrs)
-		goto err_de_attrs;
+		goto err_attrs;
 
 	for (i = 0; i < ARRAY_SIZE(pt_caps); i++) {
 		de_attrs[i].attr.attr.name = pt_caps[i].name;
@@ -155,8 +155,6 @@ static int __init pt_pmu_hw_init(void)
 	pt_cap_group.attrs = attrs;
 	return 0;
 
-err_de_attrs:
-	kfree(de_attrs);
 err_attrs:
 	kfree(attrs);
 

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-04-15 10:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09  9:08 [patch] perf/x86/intel/pt: cleanup error handling in pt_pmu_hw_init() Dan Carpenter
2015-04-09 12:02 ` Ingo Molnar
2015-04-09 12:33 ` Dan Carpenter
2015-04-09 12:45 ` Peter Zijlstra
2015-04-09 12:47 ` Alexander Shishkin
2015-04-09 13:30 ` Dan Carpenter
2015-04-09 14:54 ` Ingo Molnar
2015-04-09 15:27 ` Dan Carpenter
2015-04-11  8:37 ` Ingo Molnar
2015-04-11 11:03 ` Dan Carpenter
2015-04-12  9:38 ` Ingo Molnar
2015-04-12  9:51 ` Julia Lawall
2015-04-12 10:18 ` Ingo Molnar
2015-04-12 17:27 ` [tip:perf/core] perf/x86/intel/pt: Clean up the control flow " tip-bot for Ingo Molnar
2015-04-15 10:10 ` [patch] perf/x86/intel/pt: cleanup error handling " Alexander Shishkin
2015-04-15 10:27 ` Dan Carpenter
2015-04-15 10:50 ` Alexander Shishkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.