Skip to contentSkip to conversation

cpufreq: speedstep: convert BUG() to BUG_ON()

PATCH Applied Yangtao Li 2 participants 2 messages Feb 16, 2019 – Feb 18, 2019 CPU frequency scaling framework

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 cpufreq: speedstep: convert BUG() to BUG_ON()

To fix coccinelle WARNING.

WARNING: Use BUG_ON instead of if condition followed by BUG.

---
 drivers/cpufreq/speedstep-ich.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/speedstep-ich.c +1 -2
index fbbcb88db061..5d8a09b82efb 100644
@@ -243,8 +243,7 @@ static unsigned int speedstep_get(unsigned int cpu)
 	unsigned int speed;
 
 	/* You're supposed to ensure CPU is online. */
-	if (smp_call_function_single(cpu, get_freq_data, &speed, 1) != 0)
-		BUG();
+	BUG_ON(smp_call_function_single(cpu, get_freq_data, &speed, 1));
 
 	pr_debug("detected %u kHz as current frequency\n", speed);
 	return speed;
Signature · 1 line
2.17.0
maintainer Applied
#1 lore raw
Quoted 14 lines · Yangtao Li

To fix coccinelle WARNING.

WARNING: Use BUG_ON instead of if condition followed by BUG.

---
 drivers/cpufreq/speedstep-ich.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cpufreq/speedstep-ich.c +0 -0
index fbbcb88db061..5d8a09b82efb 100644

drivers/cpufreq/speedstep-ich.c static unsigned int speedstep_get(unsigned int cpu) · line 249

Quoted 9 lines
drivers/cpufreq/speedstep-ich.c +1 -2
@@ -243,8 +243,7 @@ static unsigned int speedstep_get(unsigned int cpu)
 	unsigned int speed;
 
 	/* You're supposed to ensure CPU is online. */
-	if (smp_call_function_single(cpu, get_freq_data, &speed, 1) != 0)
-		BUG();
+	BUG_ON(smp_call_function_single(cpu, get_freq_data, &speed, 1));
 
 	pr_debug("detected %u kHz as current frequency\n", speed);
 	return speed;

Applied. Thanks.

Signature · 1 line
viresh