summaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel
diff options
context:
space:
mode:
authorEugeniy Paltsev2018-12-13 17:56:21 +0100
committerVineet Gupta2019-01-17 23:38:00 +0100
commit29133260f7c2e4ce50b4da6bf0674331bc0a4da5 (patch)
treed7a566dbe0ccd773fe873c22e395abd701270862 /arch/arc/kernel
parentARC: perf: move HW events mapping to separate function (diff)
downloadkernel-qcow2-linux-29133260f7c2e4ce50b4da6bf0674331bc0a4da5.tar.gz
kernel-qcow2-linux-29133260f7c2e4ce50b4da6bf0674331bc0a4da5.tar.xz
kernel-qcow2-linux-29133260f7c2e4ce50b4da6bf0674331bc0a4da5.zip
ARC: perf: avoid kernel killing where it is possible
No, not gonna die tonight. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/kernel')
-rw-r--r--arch/arc/kernel/perf_event.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index 248c7b61690a..861a8aea51f9 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -580,10 +580,12 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
return -ENODEV;
}
BUILD_BUG_ON(ARC_PERF_MAX_COUNTERS > 32);
- BUG_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS);
+ if (WARN_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS))
+ return -EINVAL;
READ_BCR(ARC_REG_CC_BUILD, cc_bcr);
- BUG_ON(!cc_bcr.v); /* Counters exist but No countable conditions ? */
+ if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?"))
+ return -EINVAL;
arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL);
if (!arc_pmu)