i2c-parport: Fix misplaced parport_release call
authorJean Delvare <khali@linux-fr.org>
Fri, 28 Nov 2008 14:24:39 +0000 (15:24 +0100)
committerJean Delvare <khali@linux-fr.org>
Fri, 28 Nov 2008 14:24:39 +0000 (15:24 +0100)
We shouldn't release the parallel port until we are actually done with
it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/busses/i2c-parport.c

index 59ba208..a257cd5 100644 (file)
@@ -189,8 +189,6 @@ static void i2c_parport_attach (struct parport *port)
        if (adapter_parm[type].init.val)
                line_set(port, 1, &adapter_parm[type].init);
 
-       parport_release(adapter->pdev);
-
        if (i2c_bit_add_bus(&adapter->adapter) < 0) {
                printk(KERN_ERR "i2c-parport: Unable to register with I2C\n");
                goto ERROR1;
@@ -202,6 +200,7 @@ static void i2c_parport_attach (struct parport *port)
         return;
 
 ERROR1:
+       parport_release(adapter->pdev);
        parport_unregister_device(adapter->pdev);
 ERROR0:
        kfree(adapter);
@@ -221,6 +220,7 @@ static void i2c_parport_detach (struct parport *port)
                        if (adapter_parm[type].init.val)
                                line_set(port, 0, &adapter_parm[type].init);
                                
+                       parport_release(adapter->pdev);
                        parport_unregister_device(adapter->pdev);
                        if (prev)
                                prev->next = adapter->next;