Skip to content

Commit 1387f53

Browse files
committed
ionic: Fix maybe-uninitialized warning for wqe_size in sq/rq init
Restructure the expdb WQE size logic in sq_init and rq_init to compute the non-expdb size first, then conditionally upgrade to the expdb size if supported. This eliminates the -Werror=maybe-uninitialized warning on wqe_size and simplifies the control flow. Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
1 parent d499942 commit 1387f53

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

providers/ionic/ionic_verbs.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,18 +1674,19 @@ static int ionic_qp_sq_init(struct ionic_ctx *ctx, struct ionic_qp *qp, struct i
16741674

16751675
qp->sq.spec = ionic_v1_use_spec_sge(max_sge, ctx->spec);
16761676

1677+
wqe_size = ionic_v1_send_wqe_min_size(max_sge, max_data,
1678+
qp->sq.spec, false);
1679+
16771680
if (qp->sq.cmb & IONIC_CMB_EXPDB) {
1678-
wqe_size = ionic_v1_send_wqe_min_size(max_sge, max_data,
1679-
qp->sq.spec, true);
1681+
uint32_t expdb_size = ionic_v1_send_wqe_min_size(max_sge, max_data,
1682+
qp->sq.spec, true);
16801683

1681-
if (!ionic_expdb_wqe_size_supported(ctx, wqe_size))
1684+
if (ionic_expdb_wqe_size_supported(ctx, expdb_size))
1685+
wqe_size = expdb_size;
1686+
else
16821687
qp->sq.cmb &= ~IONIC_CMB_EXPDB;
16831688
}
16841689

1685-
if (!(qp->sq.cmb & IONIC_CMB_EXPDB))
1686-
wqe_size = ionic_v1_send_wqe_min_size(max_sge, max_data,
1687-
qp->sq.spec, false);
1688-
16891690
rc = ionic_queue_init(&qp->sq.queue, pd, IONIC_PD_TAG_SQ,
16901691
ctx->pg_shift, max_wr, wqe_size);
16911692
if (rc)
@@ -1754,16 +1755,17 @@ static int ionic_qp_rq_init(struct ionic_ctx *ctx, struct ionic_qp *qp, struct i
17541755
}
17551756
qp->rq.spec = ionic_v1_use_spec_sge(max_sge, ctx->spec);
17561757

1758+
wqe_size = ionic_v1_recv_wqe_min_size(max_sge, qp->rq.spec, false);
1759+
17571760
if (qp->rq.cmb & IONIC_CMB_EXPDB) {
1758-
wqe_size = ionic_v1_recv_wqe_min_size(max_sge, qp->rq.spec, true);
1761+
uint32_t expdb_size = ionic_v1_recv_wqe_min_size(max_sge, qp->rq.spec, true);
17591762

1760-
if (!ionic_expdb_wqe_size_supported(ctx, wqe_size))
1763+
if (ionic_expdb_wqe_size_supported(ctx, expdb_size))
1764+
wqe_size = expdb_size;
1765+
else
17611766
qp->rq.cmb &= ~IONIC_CMB_EXPDB;
17621767
}
17631768

1764-
if (!(qp->rq.cmb & IONIC_CMB_EXPDB))
1765-
wqe_size = ionic_v1_recv_wqe_min_size(max_sge, qp->rq.spec, false);
1766-
17671769
rc = ionic_queue_init(&qp->rq.queue, pd, pd_tag, ctx->pg_shift, max_wr, wqe_size);
17681770
if (rc)
17691771
goto err_rq;

0 commit comments

Comments
 (0)