[CPUFREQ] add error handling for cpufreq_register_governor() error
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 14 Jul 2008 03:00:45 +0000 (12:00 +0900)
committerDave Jones <davej@redhat.com>
Thu, 9 Oct 2008 17:52:43 +0000 (13:52 -0400)
Add error handling for cpufreq_register_governor() error

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: cpufreq@lists.linux.org.uk
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/cpufreq_ondemand.c

index 33855cb3cf16f1ecd30528f35343c2c029959b1e..67c9d4f9edc07ccd0d086e3c355cc21918444416 100644 (file)
@@ -589,12 +589,18 @@ EXPORT_SYMBOL(cpufreq_gov_ondemand);
 
 static int __init cpufreq_gov_dbs_init(void)
 {
+       int err;
+
        kondemand_wq = create_workqueue("kondemand");
        if (!kondemand_wq) {
                printk(KERN_ERR "Creation of kondemand failed\n");
                return -EFAULT;
        }
-       return cpufreq_register_governor(&cpufreq_gov_ondemand);
+       err = cpufreq_register_governor(&cpufreq_gov_ondemand);
+       if (err)
+               destroy_workqueue(kondemand_wq);
+
+       return err;
 }
 
 static void __exit cpufreq_gov_dbs_exit(void)