]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Input: wm97xx-ts - fix exit path
authorRandy Dunlap <rdunlap@infradead.org>
Mon, 15 Oct 2018 18:16:58 +0000 (11:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:21:56 +0000 (09:21 +0100)
[ Upstream commit a3f7c3fcf60868c1e90671df5d0cf9be5900a09b ]

Loading then unloading wm97xx-ts.ko when CONFIG_AC97_BUS=m
causes a WARNING: from drivers/base/driver.c:

Unexpected driver unregister!
WARNING: CPU: 0 PID: 1709 at ../drivers/base/driver.c:193 driver_unregister+0x30/0x40

Fix this by only calling driver_unregister() with the same
condition that driver_register() is called.

Fixes: ae9d1b5fbd7b ("Input: wm97xx: add new AC97 bus support")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/touchscreen/wm97xx-core.c

index 2566b4d8b3428286adb1cc6c4988ffe09d271f34..73856c2a8ac0f8dba61e72853e5b4f2e839c8487 100644 (file)
@@ -929,7 +929,8 @@ static int __init wm97xx_init(void)
 
 static void __exit wm97xx_exit(void)
 {
-       driver_unregister(&wm97xx_driver);
+       if (IS_BUILTIN(CONFIG_AC97_BUS))
+               driver_unregister(&wm97xx_driver);
        platform_driver_unregister(&wm97xx_mfd_driver);
 }