Skip to content

Commit

Permalink
[CPUFREQ] remove redundant sprintf from request_module call.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kees Cook authored and Dave Jones committed May 4, 2011
1 parent 469057d commit 1a8e146
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1a8e146

Please sign in to comment.