staging: comedi: ni_daq_700: change driver registration order
authorH Hartley Sweeten <hartleys@visionengravers.com>
Fri, 22 Jun 2012 23:15:16 +0000 (16:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jun 2012 03:55:04 +0000 (20:55 -0700)
As done with the other comedi driver types, register the
comedi_driver first then the pcmcia_driver. Also, make
sure the pcmcia_driver registration succeeds and unregister
the comedi_driver it it fails.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_daq_700.c

index b06792b3a70c9ec07b427064f1950c6d7bdd71b5..af4f10fd15dfef5048fe25507c1e370bd157ea87 100644 (file)
@@ -443,11 +443,17 @@ static int __init dio700_cs_init(void)
 {
        int ret;
 
-       ret = pcmcia_register_driver(&dio700_cs_driver);
+       ret = comedi_driver_register(&driver_dio700);
        if (ret < 0)
                return ret;
 
-       return comedi_driver_register(&driver_dio700);
+       ret = pcmcia_register_driver(&dio700_cs_driver);
+       if (ret < 0) {
+               comedi_driver_unregister(&driver_dio700);
+               return ret;
+       }
+
+       return 0;
 }
 module_init(dio700_cs_init);