From: Sudeep KarkadaNagesha Date: Tue, 10 Sep 2013 17:59:46 +0000 (+0100) Subject: cpufreq: cpufreq-cpu0: assign cpu_dev correctly to cpu0 device X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e1825b25309264bf2d1275a8da9c997bca39b0d8;p=openwrt%2Fstaging%2Fblogic.git cpufreq: cpufreq-cpu0: assign cpu_dev correctly to cpu0 device Commit f837a9b5ab05c52a07108c6f09ca66f2e0aee757 "cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes" assumed the pdev->dev is set to cpu0 device in the platform code. But it actually points to the virtual cpufreq-cpu0 platform device which is not present in the device tree. Most of the information needed by cpufreq is stored in cpu0 DT node. So cpu_dev must point to cpu0 device. This patch fixes the wrong assignment to cpu_dev. Reported-and-tested-by: Guennadi Liakhovetski Cc: Shawn Guo Signed-off-by: Sudeep KarkadaNagesha Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index cbfffa91ebdd..78c49d8e0f4a 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -177,7 +178,11 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) struct device_node *np; int ret; - cpu_dev = &pdev->dev; + cpu_dev = get_cpu_device(0); + if (!cpu_dev) { + pr_err("failed to get cpu0 device\n"); + return -ENODEV; + } np = of_node_get(cpu_dev->of_node); if (!np) {