[v3,3/4] cpuidle-haltpoll: return -ENODEV on modinit failure
diff mbox series

Message ID 20190907234524.5577-4-joao.m.martins@oracle.com
State Mainlined, archived
Delegated to: Rafael Wysocki
Headers show
  • cpuidle, haltpoll: governor switching on idle register
Related show

Commit Message

Joao Martins Sept. 7, 2019, 11:45 p.m. UTC
When a user loads cpuidle-haltpoll on a non KVM guest the module will
successfully load, even though idle driver registration didn't take

We should instead return -ENODEV signaling the user that the driver can't
be loaded, like other error paths in haltpoll_init().  An example of such
error paths is when we return -EBUSY when attempting to register an idle
driver when it had one already (e.g. intel_idle loads at boot and then we
attempt to insert module cpuidle-haltpoll).

Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver")
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
 * Added Fixes tag
 drivers/cpuidle/cpuidle-haltpoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c
index 519e90d125cf..7a0239ef717e 100644
--- a/drivers/cpuidle/cpuidle-haltpoll.c
+++ b/drivers/cpuidle/cpuidle-haltpoll.c
@@ -99,7 +99,7 @@  static int __init haltpoll_init(void)
 	if (!kvm_para_available())
-		return 0;
+		return -ENODEV;
 	ret = cpuidle_register_driver(drv);
 	if (ret < 0)