[v2,2/9] drivers: thermal: of-thermal: Print name of device node with error

Message ID f7c145e6d5164c3386f0a325a4cdcc726362f6db.1547458732.git.amit.kucheria@linaro.org
State New
Headers show
Series
  • [v2,1/9,ALREADY,QUEUED] cpufreq: qcom-hw: Move to device_initcall
Related show

Commit Message

Amit Kucheria Jan. 14, 2019, 10:21 a.m.
Make it easier to debug devicetree definition in case of errors.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>

---
 drivers/thermal/of-thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.17.1

Comments

Stephen Boyd Jan. 14, 2019, 11:54 p.m. | #1
Quoting Amit Kucheria (2019-01-14 02:21:04)
> Make it easier to debug devicetree definition in case of errors.

> 

> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>

> ---

>  drivers/thermal/of-thermal.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c

> index 4bfdb4a1e47d..08c3ccbdacf8 100644

> --- a/drivers/thermal/of-thermal.c

> +++ b/drivers/thermal/of-thermal.c

> @@ -867,14 +867,14 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)

>  

>         ret = of_property_read_u32(np, "polling-delay-passive", &prop);

>         if (ret < 0) {

> -               pr_err("missing polling-delay-passive property\n");

> +               pr_err("%pOFn: missing polling-delay-passive property\n", np->name);


Not sure you've triggered this code path because it's an error, but I'd
expect it to just be np, not np->name here. It's too bad the compiler
can't catch this.

Patch

diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 4bfdb4a1e47d..08c3ccbdacf8 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -867,14 +867,14 @@  __init *thermal_of_build_thermal_zone(struct device_node *np)
 
 	ret = of_property_read_u32(np, "polling-delay-passive", &prop);
 	if (ret < 0) {
-		pr_err("missing polling-delay-passive property\n");
+		pr_err("%pOFn: missing polling-delay-passive property\n", np->name);
 		goto free_tz;
 	}
 	tz->passive_delay = prop;
 
 	ret = of_property_read_u32(np, "polling-delay", &prop);
 	if (ret < 0) {
-		pr_err("missing polling-delay property\n");
+		pr_err("%pOFn: missing polling-delay property\n", np->name);
 		goto free_tz;
 	}
 	tz->polling_delay = prop;