mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhouyi Zhou <zhouzhouyi@gmail.com>
To: <a.p.zijlstra@chello.nl>, <paulus@samba.org>, <mingo@redhat.com>,
	<acme@kernel.org>, <tglx@linutronix.de>, <hpa@zytor.com>,
	<x86@kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Zhouyi Zhou <zhouzhouyi@gmail.com>, Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Subject: [PATCH 1/1] perf/amd: NULL return of kzalloc_node should be handled
Date: Wed, 11 Jun 2014 12:08:21 +0800	[thread overview]
Message-ID: <1402459701-20477-1-git-send-email-zhouzhouyi@gmail.com> (raw)


Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
---
 arch/x86/kernel/cpu/perf_event_amd_uncore.c |   32 +++++++++++++++------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd_uncore.c b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
index 3bbdf4c..f60a50e 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
@@ -300,24 +300,28 @@ static void amd_uncore_cpu_up_prepare(unsigned int cpu)
 
 	if (amd_uncore_nb) {
 		uncore = amd_uncore_alloc(cpu);
-		uncore->cpu = cpu;
-		uncore->num_counters = NUM_COUNTERS_NB;
-		uncore->rdpmc_base = RDPMC_BASE_NB;
-		uncore->msr_base = MSR_F15H_NB_PERF_CTL;
-		uncore->active_mask = &amd_nb_active_mask;
-		uncore->pmu = &amd_nb_pmu;
-		*per_cpu_ptr(amd_uncore_nb, cpu) = uncore;
+		if (uncore) {
+			uncore->cpu = cpu;
+			uncore->num_counters = NUM_COUNTERS_NB;
+			uncore->rdpmc_base = RDPMC_BASE_NB;
+			uncore->msr_base = MSR_F15H_NB_PERF_CTL;
+			uncore->active_mask = &amd_nb_active_mask;
+			uncore->pmu = &amd_nb_pmu;
+			*per_cpu_ptr(amd_uncore_nb, cpu) = uncore;
+		}
 	}
 
 	if (amd_uncore_l2) {
 		uncore = amd_uncore_alloc(cpu);
-		uncore->cpu = cpu;
-		uncore->num_counters = NUM_COUNTERS_L2;
-		uncore->rdpmc_base = RDPMC_BASE_L2;
-		uncore->msr_base = MSR_F16H_L2I_PERF_CTL;
-		uncore->active_mask = &amd_l2_active_mask;
-		uncore->pmu = &amd_l2_pmu;
-		*per_cpu_ptr(amd_uncore_l2, cpu) = uncore;
+		if (uncore) {
+			uncore->cpu = cpu;
+			uncore->num_counters = NUM_COUNTERS_L2;
+			uncore->rdpmc_base = RDPMC_BASE_L2;
+			uncore->msr_base = MSR_F16H_L2I_PERF_CTL;
+			uncore->active_mask = &amd_l2_active_mask;
+			uncore->pmu = &amd_l2_pmu;
+			*per_cpu_ptr(amd_uncore_l2, cpu) = uncore;
+		}
 	}
 }
 
-- 
1.7.10.4


             reply	other threads:[~2014-06-11  4:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11  4:08 Zhouyi Zhou [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-10  7:37 Zhouyi Zhou
2014-06-10  8:22 ` Peter Zijlstra
2014-06-10  8:45   ` Zhouyi Zhou
2014-06-10  8:51     ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402459701-20477-1-git-send-email-zhouzhouyi@gmail.com \
    --to=zhouzhouyi@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yizhouzhou@ict.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®