lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1425836797-3632-1-git-send-email-giedrius.statkevicius@gmail.com>
Date:	Sun,  8 Mar 2015 19:46:37 +0200
From:	Giedrius Statkevičius 
	<giedrius.statkevicius@...il.com>
To:	lidza.louina@...il.com, markh@...pro.net
Cc:	gregkh@...uxfoundation.org, driverdev-devel@...uxdriverproject.org,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
	Giedrius Statkevičius 
	<giedrius.statkevicius@...il.com>
Subject: [PATCH] dgnc: move more repeating code under 'failed' label

Currently the label is only used to return a error code to the caller but more
repeating code is before each "goto failed;" thus we can move that code to the
label. Also, remove some empty unneeded lines together with this patch in those
if's and at the end of dgnc_found_board().

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@...il.com>
---
 drivers/staging/dgnc/dgnc_driver.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index fa1ee79..73ee667 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -574,17 +574,12 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 	if (rc < 0) {
 		dgnc_tty_uninit(brd);
 		pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc);
-		brd->state = BOARD_FAILED;
-		brd->dpastatus = BD_NOFEP;
 		goto failed;
 	}
 
 	rc = dgnc_finalize_board_init(brd);
 	if (rc < 0) {
 		pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc);
-		brd->state = BOARD_FAILED;
-		brd->dpastatus = BD_NOFEP;
-
 		goto failed;
 	}
 
@@ -592,9 +587,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 	if (rc < 0) {
 		dgnc_tty_uninit(brd);
 		pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc);
-		brd->state = BOARD_FAILED;
-		brd->dpastatus = BD_NOFEP;
-
 		goto failed;
 	}
 
@@ -628,9 +620,9 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 	return 0;
 
 failed:
-
+	brd->state = BOARD_FAILED;
+	brd->dpastatus = BD_NOFEP;
 	return -ENXIO;
-
 }
 
 
-- 
2.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ