Skip to contentSkip to conversation

cpufreq: Drop unnecessary check from cpufreq_policy_alloc()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Aug 31, 2016 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: Drop unnecessary check from cpufreq_policy_alloc()

From: Rafael J. Wysocki <[email protected]>

Since cpufreq_policy_alloc() doesn't use its dev variable for anything useful, drop that variable from there along with the NULL check against it.

---
 drivers/cpufreq/cpufreq.c |    4 ----
 1 file changed, 4 deletions(-)
drivers/cpufreq/cpufreq.c +0 -4
Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
@@ -1073,13 +1073,9 @@ static void handle_update(struct work_st
 
 static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
 {
-	struct device *dev = get_cpu_device(cpu);
 	struct cpufreq_policy *policy;
 	int ret;
 
-	if (WARN_ON(!dev))
-		return NULL;
-
 	policy = kzalloc(sizeof(*policy), GFP_KERNEL);
 	if (!policy)
 		return NULL;
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Since cpufreq_policy_alloc() doesn't use its dev variable for anything useful, drop that variable from there along with the NULL check against it.

---
 drivers/cpufreq/cpufreq.c |    4 ----
 1 file changed, 4 deletions(-)

Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================

drivers/cpufreq/cpufreq.c +0 -0
@@ -1073,13 +1073,9 @@ static void handle_update(struct work_st
 
 static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
 {

drivers/cpufreq/cpufreq.c static void handle_update(struct work_st · line 1081

Quoted 10 lines
drivers/cpufreq/cpufreq.c +0 -4
-	struct device *dev = get_cpu_device(cpu);
 	struct cpufreq_policy *policy;
 	int ret;
 
-	if (WARN_ON(!dev))
-		return NULL;
-
 	policy = kzalloc(sizeof(*policy), GFP_KERNEL);
 	if (!policy)
 		return NULL;
Signature · 1 line
viresh