[CPUFREQ] remove redundant sprintf from request_module call.
authorKees Cook <kees.cook@canonical.com>
Wed, 4 May 2011 15:38:56 +0000 (08:38 -0700)
committerDave Jones <davej@redhat.com>
Wed, 4 May 2011 15:50:58 +0000 (11:50 -0400)
Since format string handling is part of request_module, there is no
need to construct the module name. As such, drop the redundant sprintf
and heap usage.

Signed-off-by: Kees Cook <kees.cook@canonical.com>
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/cpufreq.c

index 1e08af43ae72b4ad415ce2f9bdfd3e3faf597f35..0a5bea9e3585c2cc9daff87417a42e25ad4469b8 100644 (file)
@@ -321,21 +321,14 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
                t = __find_governor(str_governor);
 
                if (t == NULL) {
-                       char *name = kasprintf(GFP_KERNEL, "cpufreq_%s",
-                                                               str_governor);
+                       int ret;
 
-                       if (name) {
-                               int ret;
+                       mutex_unlock(&cpufreq_governor_mutex);
+                       ret = request_module("cpufreq_%s", str_governor);
+                       mutex_lock(&cpufreq_governor_mutex);
 
-                               mutex_unlock(&cpufreq_governor_mutex);
-                               ret = request_module("%s", name);
-                               mutex_lock(&cpufreq_governor_mutex);
-
-                               if (ret == 0)
-                                       t = __find_governor(str_governor);
-                       }
-
-                       kfree(name);
+                       if (ret == 0)
+                               t = __find_governor(str_governor);
                }
 
                if (t != NULL) {