staging: panel: register driver after checking device
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Tue, 10 Feb 2015 11:56:02 +0000 (17:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Mar 2015 00:31:57 +0000 (16:31 -0800)
register the driver only if lcd or keypad has been enabled and if
both are disabled then just exit.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/panel/panel.c

index 4da854ca311529b17723cbfe30ce78bab240436a..322b73d265d6c11b88fac3ac7ed21aa571d42c0b 100644 (file)
@@ -2377,23 +2377,17 @@ static int __init panel_init_module(void)
        /* tells various subsystems about the fact that we are initializing */
        init_in_progress = 1;
 
-       if (parport_register_driver(&panel_driver)) {
-               pr_err("could not register with parport. Aborting.\n");
-               return -EIO;
-       }
-
        if (!lcd.enabled && !keypad.enabled) {
-               /* no device enabled, let's release the parport */
-               if (pprt) {
-                       parport_release(pprt);
-                       parport_unregister_device(pprt);
-                       pprt = NULL;
-               }
-               parport_unregister_driver(&panel_driver);
+               /* no device enabled, let's exit */
                pr_err("driver version " PANEL_VERSION " disabled.\n");
                return -ENODEV;
        }
 
+       if (parport_register_driver(&panel_driver)) {
+               pr_err("could not register with parport. Aborting.\n");
+               return -EIO;
+       }
+
        register_reboot_notifier(&panel_notifier);
 
        if (pprt)