cpufreq: cpufreq_interactive: avoid NULL point access
[firefly-linux-kernel-4.4.55.git] / drivers / cpufreq / pmac64-cpufreq.c
index 8bc422977b5b88120ad93c08ac27cbea22cc80ec..4ff86878727fc0130ebf9be394f3f832c50c315d 100644 (file)
@@ -499,8 +499,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
        }
 
        /* Lookup the i2c hwclock */
-       for (hwclock = NULL;
-            (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
+       for_each_node_by_name(hwclock, "i2c-hwclock") {
                const char *loc = of_get_property(hwclock,
                                "hwctrl-location", NULL);
                if (loc == NULL)