Skip to contentSkip to conversation

cpufreq: integrator: fix integrator_cpufreq_remove return type

PATCH New Arnd Bergmann 2 participants 2 messages Sep 26, 2014 – Oct 2, 2014 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: integrator: fix integrator_cpufreq_remove return type

When building this driver as a module, we get a helpful warning about the return type:

drivers/cpufreq/integrator-cpufreq.c:232:2: warning: initialization from incompatible pointer type
.remove = __exit_p(integrator_cpufreq_remove),

If the remove callback returns void, the caller gets an undefined value as it expects an integer to be returned. This fixes the problem by passing down the value from cpufreq_unregister_driver.

---
Found while testing the integrator multiplatform patches from Linus Walleij, this shows up as a new warning in allmodconfig.

drivers/cpufreq/integrator-cpufreq.c +2 -2
index c1320528b9d0..6bd69adc3c5e 100644
@@ -213,9 +213,9 @@ static int __init integrator_cpufreq_probe(struct platform_device *pdev)
 	return cpufreq_register_driver(&integrator_driver);
 }
 
-static void __exit integrator_cpufreq_remove(struct platform_device *pdev)
+static int __exit integrator_cpufreq_remove(struct platform_device *pdev)
 {
-	cpufreq_unregister_driver(&integrator_driver);
+	return cpufreq_unregister_driver(&integrator_driver);
 }
 
 static const struct of_device_id integrator_cpufreq_match[] = {
#1 lore raw

PATCH 1/1 cpufreq: integrator: fix integrator_cpufreq_remove return type

Quoted 11 lines · Arnd Bergmann

When building this driver as a module, we get a helpful warning about the return type:

drivers/cpufreq/integrator-cpufreq.c:232:2: warning: initialization from incompatible pointer type
.remove = __exit_p(integrator_cpufreq_remove),

If the remove callback returns void, the caller gets an undefined value as it expects an integer to be returned. This fixes the problem by passing down the value from cpufreq_unregister_driver.

Yours,
Linus Walleij