nvme_fc: correct LS validation
authorJames Smart <jsmart2021@gmail.com>
Fri, 24 Mar 2017 03:41:25 +0000 (20:41 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 4 Apr 2017 15:48:23 +0000 (09:48 -0600)
LS validations shouldn't have been independent checks.

Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/fc.c

index f55ef730472b79581801ed43e573e29fdc6b0d04..a02eeb69f85ccbe711c646a669320b7d63ea0801 100644 (file)
@@ -848,11 +848,12 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
        /* validate the ACC response */
        if (assoc_acc->hdr.w0.ls_cmd != FCNVME_LS_ACC)
                fcret = VERR_LSACC;
-       if (assoc_acc->hdr.desc_list_len !=
+       else if (assoc_acc->hdr.desc_list_len !=
                        fcnvme_lsdesc_len(
                                sizeof(struct fcnvme_ls_cr_assoc_acc)))
                fcret = VERR_CR_ASSOC_ACC_LEN;
-       if (assoc_acc->hdr.rqst.desc_tag != cpu_to_be32(FCNVME_LSDESC_RQST))
+       else if (assoc_acc->hdr.rqst.desc_tag !=
+                       cpu_to_be32(FCNVME_LSDESC_RQST))
                fcret = VERR_LSDESC_RQST;
        else if (assoc_acc->hdr.rqst.desc_len !=
                        fcnvme_lsdesc_len(sizeof(struct fcnvme_lsdesc_rqst)))
@@ -955,10 +956,10 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
        /* validate the ACC response */
        if (conn_acc->hdr.w0.ls_cmd != FCNVME_LS_ACC)
                fcret = VERR_LSACC;
-       if (conn_acc->hdr.desc_list_len !=
+       else if (conn_acc->hdr.desc_list_len !=
                        fcnvme_lsdesc_len(sizeof(struct fcnvme_ls_cr_conn_acc)))
                fcret = VERR_CR_CONN_ACC_LEN;
-       if (conn_acc->hdr.rqst.desc_tag != cpu_to_be32(FCNVME_LSDESC_RQST))
+       else if (conn_acc->hdr.rqst.desc_tag != cpu_to_be32(FCNVME_LSDESC_RQST))
                fcret = VERR_LSDESC_RQST;
        else if (conn_acc->hdr.rqst.desc_len !=
                        fcnvme_lsdesc_len(sizeof(struct fcnvme_lsdesc_rqst)))