Skip to contentSkip to conversation

cpufreq: cpufreq_register_driver should return -ENODEV if init fails

PATCH In review David Arcari 3 participants 4 messages May 26, 2017 – May 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: cpufreq_register_driver should return -ENODEV if init fails

For a driver that does not set the CPUFREQ_STICKY flag, if all of the ->init() calls fail, cpufreq_register_driver() should return an error. This will prevent the driver from loading.

Fixes ce1bcfe94db8 ("cpufreq: check cpufreq_policy_list instead of scanning policies for all CPUs")
---
 drivers/cpufreq/cpufreq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq.c +1 -0
index 0e3f649..26b643d 100644
@@ -2468,6 +2468,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
 	if (!(cpufreq_driver->flags & CPUFREQ_STICKY) &&
 	    list_empty(&cpufreq_policy_list)) {
 		/* if all ->init() calls failed, unregister */
+		ret = -ENODEV;
 		pr_debug("%s: No CPU initialized for driver %s\n", __func__,
 			 driver_data->name);
 		goto err_if_unreg;
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw

You sent it to the wrong list and missed Rafael too. MAINTAINERS file should help getting these details in the future.

Quoted 8 lines · David Arcari

For a driver that does not set the CPUFREQ_STICKY flag, if all of the ->init() calls fail, cpufreq_register_driver() should return an error. This will prevent the driver from loading.

Fixes ce1bcfe94db8 ("cpufreq: check cpufreq_policy_list instead of scanning policies for all CPUs")

+
Cc: 4.0+ <[email protected]> # 4.0+

Quoted 9 lines
---
 drivers/cpufreq/cpufreq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq.c +0 -0
index 0e3f649..26b643d 100644

drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2474

Quoted 7 lines
drivers/cpufreq/cpufreq.c +1 -0
@@ -2468,6 +2468,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
 	if (!(cpufreq_driver->flags & CPUFREQ_STICKY) &&
 	    list_empty(&cpufreq_policy_list)) {
 		/* if all ->init() calls failed, unregister */
+		ret = -ENODEV;
 		pr_debug("%s: No CPU initialized for driver %s\n", __func__,
 			 driver_data->name);
 		goto err_if_unreg;
Signature · 1 line
viresh
#2 lore raw
Quoted 2 lines · Viresh Kumar

You sent it to the wrong list and missed Rafael too. MAINTAINERS file should help getting these details in the future.

Oops - my bad.

Rafael - is this OK as is or would you prefer I resend this?

Thanks,

-DA

Quoted 33 lines · David Arcari
Quoted 8 lines

For a driver that does not set the CPUFREQ_STICKY flag, if all of the ->init() calls fail, cpufreq_register_driver() should return an error. This will prevent the driver from loading.

Fixes ce1bcfe94db8 ("cpufreq: check cpufreq_policy_list instead of scanning policies for all CPUs")

+
Cc: 4.0+ <[email protected]> # 4.0+

Quoted 9 lines
---
 drivers/cpufreq/cpufreq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq.c +0 -0
index 0e3f649..26b643d 100644

drivers/cpufreq/cpufreq.c int cpufreq_register_driver(struct cpufreq_driver *driver_data) · line 2474

Quoted 7 lines
drivers/cpufreq/cpufreq.c +1 -0
@@ -2468,6 +2468,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
 	if (!(cpufreq_driver->flags & CPUFREQ_STICKY) &&
 	    list_empty(&cpufreq_policy_list)) {
 		/* if all ->init() calls failed, unregister */
+		ret = -ENODEV;
 		pr_debug("%s: No CPU initialized for driver %s\n", __func__,
 			 driver_data->name);
 		goto err_if_unreg;
#3 lore raw
Quoted 7 lines · David Arcari
Quoted 2 lines · Viresh Kumar

You sent it to the wrong list and missed Rafael too. MAINTAINERS file should help getting these details in the future.

Oops - my bad.

Rafael - is this OK as is or would you prefer I resend this?

No need to resend, thanks!

I've actually queued it up already.

Thanks,
Rafael