Skip to contentSkip to conversation

RDMA/irdma: Fix missing error code in irdma_modify_qp_roce()

PATCH In review Jiapeng Chong 2 participants 2 messages Jul 26, 2021

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

PATCH v2 1/1 RDMA/irdma: Fix missing error code in irdma_modify_qp_roce()

The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'ret'.

Eliminate the follow smatch warning:

drivers/infiniband/hw/irdma/verbs.c:1344 irdma_modify_qp_roce() warn:
missing error code 'ret'.

Fixes b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")

---
Changes in v2:
-For the follow advice: https://lore.kernel.org/patchwork/patch/1466463/

 drivers/infiniband/hw/irdma/verbs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/verbs.c +3 -1
index 717147e..721cb0c 100644
@@ -1340,8 +1340,10 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 			}
 			break;
 		case IB_QPS_SQD:
-			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD)
+			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD) {
+				ret = -EINVAL;
 				goto exit;
+			}
 
 			if (iwqp->iwarp_state != IRDMA_QP_STATE_RTS) {
 				ret = -EINVAL;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 23 lines · Jiapeng Chong

The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'ret'.

Eliminate the follow smatch warning:

drivers/infiniband/hw/irdma/verbs.c:1344 irdma_modify_qp_roce() warn:
missing error code 'ret'.

Fixes b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")

---
Changes in v2:
-For the follow advice: https://lore.kernel.org/patchwork/patch/1466463/

 drivers/infiniband/hw/irdma/verbs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/verbs.c +0 -0
index 717147e..721cb0c 100644

drivers/infiniband/hw/irdma/verbs.c int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, · line 1345

Quoted 7 lines
drivers/infiniband/hw/irdma/verbs.c +2 -1
@@ -1340,8 +1340,10 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 			}
 			break;
 		case IB_QPS_SQD:
-			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD)
+			if (iwqp->iwarp_state == IRDMA_QP_STATE_SQD) {
+				ret = -EINVAL;
 				goto exit;

It is wrong, SQD-to-SQD is a valid transition and ret should be 0, which is already set at the beginning of that function.

Thanks

Quoted 7 lines
drivers/infiniband/hw/irdma/verbs.c +1 -0
+			}
 
 			if (iwqp->iwarp_state != IRDMA_QP_STATE_RTS) {
 				ret = -EINVAL;
Signature · 1 line
1.8.3.1