diff mbox series

qla2xxx: Use constant when it is known.

Message ID 20200921112340.GA19336@duo.ucw.cz (mailing list archive)
State Accepted
Headers show
Series qla2xxx: Use constant when it is known. | expand

Commit Message

Pavel Machek Sept. 21, 2020, 11:23 a.m. UTC
Directly return constant when it is known, to make code easier to
understand.

Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>

Comments

Himanshu Madhani Oct. 7, 2020, 1:29 p.m. UTC | #1
> On Sep 21, 2020, at 6:23 AM, Pavel Machek <pavel@denx.de> wrote:
> 
> Directly return constant when it is known, to make code easier to
> understand.
> 
> Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index 90bbc61f361b..248197e9e8ea 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -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;
> 	/*
> 
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering
Martin K. Petersen Oct. 8, 2020, 2:12 a.m. UTC | #2
Pavel,

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

Applied to 5.10/scsi-staging, thanks!
Martin K. Petersen Oct. 13, 2020, 10:42 p.m. UTC | #3
On Mon, 21 Sep 2020 13:23:40 +0200, Pavel Machek wrote:

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

Applied to 5.10/scsi-queue, thanks!

[1/1] scsi: qla2xxx: Use constant when it is known
      https://git.kernel.org/mkp/scsi/c/b994718760fa
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 90bbc61f361b..248197e9e8ea 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -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;
 	/*