Skip to contentSkip to conversation

cpufreq: pcc-cpufreq: Fail initialization if driver cannot be registered

PATCH Applied David Arcari 3 participants 3 messages Jun 6, 2019 – Jun 27, 2019 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: pcc-cpufreq: Fail initialization if driver cannot be registered

Make pcc_cpufreq_init() return error codes when the driver cannot be registered. Otherwise the driver can shows up loaded via lsmod even though it failed initialization. This is confusing to the user.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
---
 drivers/cpufreq/pcc-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/pcc-cpufreq.c +2 -2
index 1e5e64643c3a..fdc767fdbe6a 100644
@@ -582,10 +582,10 @@ static int __init pcc_cpufreq_init(void)
 
 	/* Skip initialization if another cpufreq driver is there. */
 	if (cpufreq_get_current_driver())
-		return 0;
+		return -EEXIST;
 
 	if (acpi_disabled)
-		return 0;
+		return -ENODEV;
 
 	ret = pcc_cpufreq_probe();
 	if (ret) {
Signature · 1 line
2.18.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · David Arcari

Make pcc_cpufreq_init() return error codes when the driver cannot be registered. Otherwise the driver can shows up loaded via lsmod even though it failed initialization. This is confusing to the user.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
---
 drivers/cpufreq/pcc-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/pcc-cpufreq.c +0 -0
index 1e5e64643c3a..fdc767fdbe6a 100644
@@ -582,10 +582,10 @@ static int __init pcc_cpufreq_init(void)
 
 	/* Skip initialization if another cpufreq driver is there. */

drivers/cpufreq/pcc-cpufreq.c static int __init pcc_cpufreq_init(void) · line 591

Quoted 10 lines
drivers/cpufreq/pcc-cpufreq.c +2 -2
 	if (cpufreq_get_current_driver())
-		return 0;
+		return -EEXIST;
 
 	if (acpi_disabled)
-		return 0;
+		return -ENODEV;
 
 	ret = pcc_cpufreq_probe();
 	if (ret) {
Signature · 1 line
viresh
#2 lore raw
Quoted 23 lines · CEST Viresh Kumar
Quoted 22 lines · David Arcari

Make pcc_cpufreq_init() return error codes when the driver cannot be registered. Otherwise the driver can shows up loaded via lsmod even though it failed initialization. This is confusing to the user.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
---
 drivers/cpufreq/pcc-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/pcc-cpufreq.c +1 -1
index 1e5e64643c3a..fdc767fdbe6a 100644
@@ -582,10 +582,10 @@ static int __init pcc_cpufreq_init(void)
 
 	/* Skip initialization if another cpufreq driver is there. */
 	if (cpufreq_get_current_driver())
-		return 0;
+		return -EEXIST;
 
Quoted 8 lines

drivers/cpufreq/pcc-cpufreq.c static int __init pcc_cpufreq_init(void) · line 591

Quoted 6 lines
drivers/cpufreq/pcc-cpufreq.c +1 -1
 	if (acpi_disabled)
-		return 0;
+		return -ENODEV;
 
 	ret = pcc_cpufreq_probe();
 	if (ret) {

Applied, thanks!