clocksource: mtk: Fix race conditions in probe code
clocksource: mtk: Fix race conditions in probe code

We have two race conditions in the probe code which could lead to a null
pointer dereference in the interrupt handler.

The interrupt handler accesses the clockevent device, which may not yet be
registered.

First race condition happens when the interrupt handler gets registered before
the interrupts get disabled. The second race condition happens when the
interrupts get enabled, but the clockevent device is not yet registered.

Fix that by disabling the interrupts before we register the interrupt and enable
the interrupts after the clockevent device got registered.

Reported-by: Gongbae Park <0edff3c52d58f1b3f2e8c1e7d34abde7e48daec4@gmail.com>
Signed-off-by: Matthias Brugger <28c780319e2c7f6db09304375fbd148f9c25d13f@gmail.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Signed-off-by: Daniel Lezcano <e9fa45941f2ebe89c1b9d6c5f339ab42eadb8567@linaro.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs