]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: dgap: refactor ugly dgap_init_one function
authorMark Hounschell <markh@compro.net>
Fri, 25 Apr 2014 18:19:42 +0000 (14:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 May 2014 23:07:03 +0000 (16:07 -0700)
This patch just cleans up the ugly dgap_init_one function

Signed-off-by: Mark Hounschell <markh@compro.net>
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgap/dgap.c

index f597432ede8c1fc6202bceeb70e1d25854f536c9..f2ad7ae8036e8e1700d08cd745359c4e8ca82b51 100644 (file)
@@ -575,19 +575,16 @@ static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (dgap_NumBoards >= MAXBOARDS)
                return -EPERM;
 
-       /* wake up and enable device */
        rc = pci_enable_device(pdev);
+       if (rc)
+               return -EIO;
 
-       if (rc < 0) {
-               rc = -EIO;
-       } else {
-               rc = dgap_probe1(pdev, ent->driver_data);
-               if (rc == 0) {
-                       dgap_NumBoards++;
-                       rc = dgap_firmware_load(pdev, ent->driver_data);
-               }
-       }
-       return rc;
+       rc = dgap_probe1(pdev, ent->driver_data);
+       if (rc)
+               return rc;
+
+       dgap_NumBoards++;
+       return dgap_firmware_load(pdev, ent->driver_data);
 }
 
 static int dgap_probe1(struct pci_dev *pdev, int card_type)