From: Ranjani Vaidyanathan Date: Thu, 12 Sep 2013 19:44:20 +0000 (-0500) Subject: ENGR00279545 [MX6x:Cpufreq] Initialize mutex before driver registration X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a2b5e3f96b650086daa1d63de0f0c615f1d20d31;p=karo-tx-linux.git ENGR00279545 [MX6x:Cpufreq] Initialize mutex before driver registration The mutex, set_cpufreq_lock, should be initialized before the driver is registered. Else if the default governor is set to performance or ondemand, the cpufreq driver will try to set the freq to the max freq supported and this will cause a crash during boot. Signed-off-by: Ranjani Vaidyanathan --- diff --git a/drivers/cpufreq/cpufreq-imx6.c b/drivers/cpufreq/cpufreq-imx6.c index 51861d668ee3..eb7baacf6fdf 100644 --- a/drivers/cpufreq/cpufreq-imx6.c +++ b/drivers/cpufreq/cpufreq-imx6.c @@ -441,15 +441,15 @@ static int imx6_cpufreq_probe(struct platform_device *pdev) if (ret > 0) transition_latency += ret * 1000; + mutex_init(&set_cpufreq_lock); + register_pm_notifier(&imx6_cpufreq_pm_notifier); + ret = cpufreq_register_driver(&imx6_cpufreq_driver); if (ret) { dev_err(cpu_dev, "failed register driver: %d\n", ret); goto free_freq_table; } - mutex_init(&set_cpufreq_lock); - register_pm_notifier(&imx6_cpufreq_pm_notifier); - of_node_put(np); return 0;