From 4cd646a44ae3aa78b55bd5e2bce2e5d7f6f53b0d Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Mon, 21 Mar 2016 11:07:15 +0000 Subject: [PATCH] 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 Signed-off-by: Will Deacon Git-commit: 357b565d5d52b2dc2a51390eb8f887a9caa8597f Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git CRs-Fixed: 1008368 Change-Id: I446e06972d714f7a405ff8c264d7851958e69484 Signed-off-by: Jeremy Gebben --- drivers/perf/arm_pmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 54cf13286630..3d06ccc32650 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -1003,8 +1003,7 @@ int arm_pmu_device_probe(struct platform_device *pdev, } if (ret) { - pr_info("%s: failed to probe PMU! Error %i\n", - node->full_name, ret); + pr_info("%s: failed to probe PMU!\n", of_node_full_name(node)); goto out_free; } @@ -1024,8 +1023,8 @@ int arm_pmu_device_probe(struct platform_device *pdev, out_destroy: cpu_pmu_destroy(pmu); out_free: - pr_info("%s: failed to register PMU devices! Error %i\n", - node->full_name, ret); + pr_info("%s: failed to register PMU devices!\n", + of_node_full_name(node)); kfree(pmu); return ret; }