summaryrefslogtreecommitdiffstats
path: root/drivers/perf
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2016-03-21 07:07:15 -0400
committerWill Deacon <will.deacon@arm.com>2016-03-21 07:36:17 -0400
commit357b565d5d52b2dc2a51390eb8f887a9caa8597f (patch)
tree0720017fa61ca0f3e6a152d30d82b4c2a1914fb5 /drivers/perf
parentfe638401a091f4473e9e30942ea3cecc0c0b2b94 (diff)
drivers/perf: arm_pmu: avoid NULL dereference when not using devicetree
Commit c6b90653f1f7 ("drivers/perf: arm_pmu: make info messages more verbose") breaks booting on systems where the PMU is probed without devicetree (e.g by inspecting the MIDR of the current CPU). In this case, pdev->dev.of_node is NULL and we shouldn't try to access its ->fullname field when printing probe error messages. This patch fixes the probing code to use of_node_full_name, which safely handles NULL nodes and removes the "Error %i" part of the string, since it's not terribly useful. Reported-by: Guenter Roeck <private@roeck-us.net> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/arm_pmu.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 11bacc7220a1..32346b5a8a11 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -1002,8 +1002,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
1002 } 1002 }
1003 1003
1004 if (ret) { 1004 if (ret) {
1005 pr_info("%s: failed to probe PMU! Error %i\n", 1005 pr_info("%s: failed to probe PMU!\n", of_node_full_name(node));
1006 node->full_name, ret);
1007 goto out_free; 1006 goto out_free;
1008 } 1007 }
1009 1008
@@ -1023,8 +1022,8 @@ int arm_pmu_device_probe(struct platform_device *pdev,
1023out_destroy: 1022out_destroy:
1024 cpu_pmu_destroy(pmu); 1023 cpu_pmu_destroy(pmu);
1025out_free: 1024out_free:
1026 pr_info("%s: failed to register PMU devices! Error %i\n", 1025 pr_info("%s: failed to register PMU devices!\n",
1027 node->full_name, ret); 1026 of_node_full_name(node));
1028 kfree(pmu); 1027 kfree(pmu);
1029 return ret; 1028 return ret;
1030} 1029}