Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: wm97xx-ts - fix exit path

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>

authored by

Randy Dunlap and committed by
Dmitry Torokhov
a3f7c3fc d9265e8a

+2 -1
+2 -1
drivers/input/touchscreen/wm97xx-core.c
··· 929 929 930 930 static void __exit wm97xx_exit(void) 931 931 { 932 - driver_unregister(&wm97xx_driver); 932 + if (IS_BUILTIN(CONFIG_AC97_BUS)) 933 + driver_unregister(&wm97xx_driver); 933 934 platform_driver_unregister(&wm97xx_mfd_driver); 934 935 } 935 936