kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SCSI-dpt_i2o: Use common error handling code in adpt_hba_reset()
@ 2017-11-02 17:04 SF Markus Elfring
  0 siblings, 0 replies; only message in thread
From: SF Markus Elfring @ 2017-11-02 17:04 UTC (permalink / raw)
  To: linux-scsi, aacraid, James E. J. Bottomley, Martin K. Petersen
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 2 Nov 2017 17:45:14 +0100

* Adjust five function calls together with a variable assignment.

* Add a jump target so that a bit of exception handling can be better
  reused at the end of this function.

  This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/scsi/dpt_i2o.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index fd172b0890d3..cbe1a36fb531 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -832,37 +832,40 @@ static int adpt_hba_reset(adpt_hba* pHba)
 	pHba->state |= DPTI_STATE_RESET;
 
 	// Activate does get status , init outbound, and get hrt
-	if ((rcode計t_i2o_activate_hba(pHba)) < 0) {
+	rcode = adpt_i2o_activate_hba(pHba);
+	if (rcode < 0) {
 		printk(KERN_ERR "%s: Could not activate\n", pHba->name);
-		adpt_i2o_delete_hba(pHba);
-		return rcode;
+		goto delete_hba;
 	}
 
-	if ((rcode計t_i2o_build_sys_table()) < 0) {
-		adpt_i2o_delete_hba(pHba);
-		return rcode;
-	}
+	rcode = adpt_i2o_build_sys_table();
+	if (rcode < 0)
+		goto delete_hba;
+
 	PDEBUG("%s: in HOLD state\n",pHba->name);
 
-	if ((rcode計t_i2o_online_hba(pHba)) < 0) {
-		adpt_i2o_delete_hba(pHba);	
-		return rcode;
-	}
+	rcode = adpt_i2o_online_hba(pHba);
+	if (rcode < 0)
+		goto delete_hba;
+
 	PDEBUG("%s: in OPERATIONAL state\n",pHba->name);
 
-	if ((rcode計t_i2o_lct_get(pHba)) < 0){
-		adpt_i2o_delete_hba(pHba);
-		return rcode;
-	}
+	rcode = adpt_i2o_lct_get(pHba);
+	if (rcode < 0)
+		goto delete_hba;
+
+	rcode = adpt_i2o_reparse_lct(pHba);
+	if (rcode < 0)
+		goto delete_hba;
 
-	if ((rcode計t_i2o_reparse_lct(pHba)) < 0){
-		adpt_i2o_delete_hba(pHba);
-		return rcode;
-	}
 	pHba->state &= ~DPTI_STATE_RESET;
 
 	adpt_fail_posted_scbs(pHba);
 	return 0;	/* return success */
+
+delete_hba:
+	adpt_i2o_delete_hba(pHba);
+	return rcode;
 }
 
 /*=====================================-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-02 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 17:04 [PATCH] SCSI-dpt_i2o: Use common error handling code in adpt_hba_reset() SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).