Skip to contentSkip to conversation

video: fbdev: via: Fix error in via_core_init()

PATCH Applied Shang XiaoJing 2 participants 2 messages Nov 14, 2022

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

PATCH 1/1 video: fbdev: via: Fix error in via_core_init()

via_core_init() won't exit the driver when pci_register_driver() failed. Exit the viafb-i2c and the viafb-gpio in failed path to prevent error.

VIA Graphics Integration Chipset framebuffer 2.4 initializing
Error: Driver 'viafb-i2c' is already registered, aborting...
Error: Driver 'viafb-gpio' is already registered, aborting...

Fixes 7582eb9be85f ("viafb: Turn GPIO and i2c into proper platform devices")
---
 drivers/video/fbdev/via/via-core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/video/fbdev/via/via-core.c +9 -1
index 2ee8fcae08df..b2e3b5df38cd 100644
@@ -730,7 +730,15 @@ static int __init via_core_init(void)
 		return ret;
 	viafb_i2c_init();
 	viafb_gpio_init();
-	return pci_register_driver(&via_driver);
+	ret = pci_register_driver(&via_driver);
+	if (ret) {
+		viafb_gpio_exit();
+		viafb_i2c_exit();
+		viafb_exit();
+		return ret;
+	}
+
+	return 0;
 }
 
 static void __exit via_core_exit(void)
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Shang XiaoJing

via_core_init() won't exit the driver when pci_register_driver() failed. Exit the viafb-i2c and the viafb-gpio in failed path to prevent error.

VIA Graphics Integration Chipset framebuffer 2.4 initializing
Error: Driver 'viafb-i2c' is already registered, aborting...
Error: Driver 'viafb-gpio' is already registered, aborting...

Fixes 7582eb9be85f ("viafb: Turn GPIO and i2c into proper platform devices")

applied.
Thanks!
Helge

Quoted 25 lines
---
  drivers/video/fbdev/via/via-core.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/video/fbdev/via/via-core.c +9 -1
index 2ee8fcae08df..b2e3b5df38cd 100644
@@ -730,7 +730,15 @@ static int __init via_core_init(void)
  		return ret;
  	viafb_i2c_init();
  	viafb_gpio_init();
-	return pci_register_driver(&via_driver);
+	ret = pci_register_driver(&via_driver);
+	if (ret) {
+		viafb_gpio_exit();
+		viafb_i2c_exit();
+		viafb_exit();
+		return ret;
+	}
+
+	return 0;
  }
 
  static void __exit via_core_exit(void)