Skip to contentSkip to conversation

qla2xxx: Use constant when it is known.

PATCH Applied Pavel Machek 3 participants 4 messages Sep 21, 2020 – Oct 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qla2xxx: Use constant when it is known.

Directly return constant when it is known, to make code easier to understand.

drivers/scsi/qla2xxx/qla_nvme.c +3 -3
index 90bbc61f361b..248197e9e8ea 100644
@@ -530,7 +530,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	fc_port_t *fcport;
 	struct srb_iocb *nvme;
 	struct scsi_qla_host *vha;
-	int rval = -ENODEV;
+	int rval;
 	srb_t *sp;
 	struct qla_qpair *qpair = hw_queue_handle;
 	struct nvme_private *priv = fd->private;
@@ -538,14 +538,14 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 
 	if (!priv) {
 		/* nvme association has been torn down */
-		return rval;
+		return -ENODEV;
 	}
 
 	fcport = qla_rport->fcport;
 
 	if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
 	    (fcport && fcport->deleted))
-		return rval;
+		return -ENODEV;
 
 	vha = fcport->vha;
 	/*
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Reviewed-by on v1 1/1
#1 lore raw
Quoted 43 lines · Pavel Machek

Directly return constant when it is known, to make code easier to understand.

drivers/scsi/qla2xxx/qla_nvme.c +3 -3
index 90bbc61f361b..248197e9e8ea 100644
@@ -530,7 +530,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	fc_port_t *fcport;
 	struct srb_iocb *nvme;
 	struct scsi_qla_host *vha;
-	int rval = -ENODEV;
+	int rval;
 	srb_t *sp;
 	struct qla_qpair *qpair = hw_queue_handle;
 	struct nvme_private *priv = fd->private;
@@ -538,14 +538,14 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 
 	if (!priv) {
 		/* nvme association has been torn down */
-		return rval;
+		return -ENODEV;
 	}
 
 	fcport = qla_rport->fcport;
 
 	if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
 	    (fcport && fcport->deleted))
-		return rval;
+		return -ENODEV;
 
 	vha = fcport->vha;
 	/*
Signature · 3 lines
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

--
Himanshu Madhani Oracle Linux Engineering

#2 lore raw
In reply to Pavel Machek

Pavel,

Quoted 2 lines

Directly return constant when it is known, to make code easier to understand.

Applied to 5.10/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering