ARM: vexpress: Ensure SPC driver is loaded before using it in PSCI init
authorJon Medhurst <tixy@linaro.org>
Wed, 19 Jun 2013 09:17:00 +0000 (10:17 +0100)
committerJon Medhurst <tixy@linaro.org>
Mon, 1 Jul 2013 10:05:16 +0000 (11:05 +0100)
Otherwise we get a nullptr dereference calling vexpress_spc_get_nb_cpus.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
arch/arm/mach-vexpress/tc2_pm_psci.c

index 5a5e4f568497c9e7763e94661370ac487a6f3c40..c2fdc22e4c0686a81a7bf4205fc66d32b0024754 100644 (file)
@@ -155,6 +155,11 @@ static int __init tc2_pm_psci_init(void)
                return -ENODEV;
        }
 
+       if (!vexpress_spc_check_loaded()) {
+               pr_debug("spc not found. Aborting psci init\n");
+               return -ENODEV;
+       }
+
        tc2_pm_usage_count_init();
 
        ret = mcpm_platform_register(&tc2_pm_power_ops);