diff options
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1109f6848a43..5cb4d09919d6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1919,8 +1919,10 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1919 | 1919 | ||
1920 | ret = sysdev_driver_register(&cpu_sysdev_class, | 1920 | ret = sysdev_driver_register(&cpu_sysdev_class, |
1921 | &cpufreq_sysdev_driver); | 1921 | &cpufreq_sysdev_driver); |
1922 | if (ret) | ||
1923 | goto err_null_driver; | ||
1922 | 1924 | ||
1923 | if ((!ret) && !(cpufreq_driver->flags & CPUFREQ_STICKY)) { | 1925 | if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { |
1924 | int i; | 1926 | int i; |
1925 | ret = -ENODEV; | 1927 | ret = -ENODEV; |
1926 | 1928 | ||
@@ -1935,21 +1937,22 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1935 | if (ret) { | 1937 | if (ret) { |
1936 | dprintk("no CPU initialized for driver %s\n", | 1938 | dprintk("no CPU initialized for driver %s\n", |
1937 | driver_data->name); | 1939 | driver_data->name); |
1938 | sysdev_driver_unregister(&cpu_sysdev_class, | 1940 | goto err_sysdev_unreg; |
1939 | &cpufreq_sysdev_driver); | ||
1940 | |||
1941 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | ||
1942 | cpufreq_driver = NULL; | ||
1943 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | ||
1944 | } | 1941 | } |
1945 | } | 1942 | } |
1946 | 1943 | ||
1947 | if (!ret) { | 1944 | register_hotcpu_notifier(&cpufreq_cpu_notifier); |
1948 | register_hotcpu_notifier(&cpufreq_cpu_notifier); | 1945 | dprintk("driver %s up and running\n", driver_data->name); |
1949 | dprintk("driver %s up and running\n", driver_data->name); | 1946 | cpufreq_debug_enable_ratelimit(); |
1950 | cpufreq_debug_enable_ratelimit(); | ||
1951 | } | ||
1952 | 1947 | ||
1948 | return 0; | ||
1949 | err_sysdev_unreg: | ||
1950 | sysdev_driver_unregister(&cpu_sysdev_class, | ||
1951 | &cpufreq_sysdev_driver); | ||
1952 | err_null_driver: | ||
1953 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | ||
1954 | cpufreq_driver = NULL; | ||
1955 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | ||
1953 | return ret; | 1956 | return ret; |
1954 | } | 1957 | } |
1955 | EXPORT_SYMBOL_GPL(cpufreq_register_driver); | 1958 | EXPORT_SYMBOL_GPL(cpufreq_register_driver); |