[PATCH] staging: dgap: refactor ugly dgap_init_one function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch just cleans up the ugly dgap_init_one function

Signed-off-by: Mark Hounschell <markh@xxxxxxxxxx>
Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Tested-by: Mark Hounschell <markh@xxxxxxxxxx>
---
 drivers/staging/dgap/dgap.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index f597432..f2ad7ae 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -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)
-- 
1.8.4.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux