]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
clocksource: arm_arch_timer: fix system hang
authorAl Stone <ahs3@redhat.com>
Tue, 11 Nov 2014 00:11:20 +0000 (17:11 -0700)
committerJulien Grall <julien.grall@citrix.com>
Mon, 28 Sep 2015 11:05:18 +0000 (12:05 +0100)
Arm allows for two possible architectural clock sources. One memory mapped
and the other coprocessor based. If both timers exist, then the driver waits
for both to be probed before registering a clocksource.

Commit c387f07e6205 ("clocksource: arm_arch_timer: Discard unavailable timers
correctly") attempted to fix a hang occurring when one of the two possible
timers had a device node, but was disabled. In that case, the second probe
would never occur and the system would hang without a clocksource being
registered.

Unfortunately, incorrect logic in that commit made things worse such that
a hang would occur unless both timers had a device node and were enabled.
This patch fixes the logic so that we don't wait to probe a second timer
unless it exists and is enabled.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
drivers/clocksource/arm_arch_timer.c

index 0aa135ddbf8069e780c60f34c05a44c9e0fc0dfb..17ad6f4e187c70d687babdc804e6eb7c865cb3fb 100644 (file)
@@ -672,10 +672,11 @@ arch_timer_needs_probing(int type, const struct of_device_id *matches)
        bool needs_probing = false;
 
        dn = of_find_matching_node(NULL, matches);
-       if (dn && of_device_is_available(dn) && !(arch_timers_present & type))
-               needs_probing = true;
-       of_node_put(dn);
-
+       if (dn) {
+               if (dn && of_device_is_available(dn) && !(arch_timers_present & type))
+                       needs_probing = true;
+               of_node_put(dn);
+       }
        return needs_probing;
 }