aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq-dt-platdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq-dt-platdev.c')
-rw-r--r--drivers/cpufreq/cpufreq-dt-platdev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 3646b143bbf5..0bb44d5b5df4 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -79,15 +79,16 @@ static const struct of_device_id machines[] __initconst = {
79static int __init cpufreq_dt_platdev_init(void) 79static int __init cpufreq_dt_platdev_init(void)
80{ 80{
81 struct device_node *np = of_find_node_by_path("/"); 81 struct device_node *np = of_find_node_by_path("/");
82 const struct of_device_id *match;
82 83
83 if (!np) 84 if (!np)
84 return -ENODEV; 85 return -ENODEV;
85 86
86 if (!of_match_node(machines, np)) 87 match = of_match_node(machines, np);
88 of_node_put(np);
89 if (!match)
87 return -ENODEV; 90 return -ENODEV;
88 91
89 of_node_put(of_root);
90
91 return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, 92 return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1,
92 NULL, 0)); 93 NULL, 0));
93} 94}