> -----Original Message----- > From: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> > Sent: Monday, October 9, 2023 9:18 AM > To: Bernard Metzler <BMT@xxxxxxxxxxxxxx>; jgg@xxxxxxxx; leon@xxxxxxxxxx > Cc: linux-rdma@xxxxxxxxxxxxxxx > Subject: [EXTERNAL] [PATCH 11/19] RDMA/siw: Introduce > siw_cep_set_free_and_put > > Add the helper which can be used in some places. > > Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> > --- > drivers/infiniband/sw/siw/siw_cm.c | 31 ++++++++++++++---------------- > 1 file changed, 14 insertions(+), 17 deletions(-) > > diff --git a/drivers/infiniband/sw/siw/siw_cm.c > b/drivers/infiniband/sw/siw/siw_cm.c > index c8a9118677d7..2f338bb3a24c 100644 > --- a/drivers/infiniband/sw/siw/siw_cm.c > +++ b/drivers/infiniband/sw/siw/siw_cm.c > @@ -444,6 +444,12 @@ void siw_cep_put(struct siw_cep *cep) > kref_put(&cep->ref, __siw_cep_dealloc); > } > > +static void siw_cep_set_free_and_put(struct siw_cep *cep) > +{ > + siw_cep_set_free(cep); > + siw_cep_put(cep); > +} > + > void siw_cep_get(struct siw_cep *cep) > { > kref_get(&cep->ref); > @@ -1506,9 +1512,7 @@ int siw_connect(struct iw_cm_id *id, struct > iw_cm_conn_param *params) > > cep->state = SIW_EPSTATE_CLOSED; > > - siw_cep_set_free(cep); > - > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > > } else if (s) { > sock_release(s); > @@ -1556,16 +1560,14 @@ int siw_accept(struct iw_cm_id *id, struct > iw_cm_conn_param *params) > if (cep->state != SIW_EPSTATE_RECVD_MPAREQ) { > siw_dbg_cep(cep, "out of state\n"); > > - siw_cep_set_free(cep); > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > > return -ECONNRESET; > } > qp = siw_qp_id2obj(sdev, params->qpn); > if (!qp) { > WARN(1, "[QP %d] does not exist\n", params->qpn); > - siw_cep_set_free(cep); > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > > return -EINVAL; > } > @@ -1711,8 +1713,7 @@ int siw_accept(struct iw_cm_id *id, struct > iw_cm_conn_param *params) > cep->qp = NULL; > siw_qp_put(qp); > > - siw_cep_set_free(cep); > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > > return rv; > } > @@ -1735,8 +1736,7 @@ int siw_reject(struct iw_cm_id *id, const void > *pdata, u8 pd_len) > if (cep->state != SIW_EPSTATE_RECVD_MPAREQ) { > siw_dbg_cep(cep, "out of state\n"); > > - siw_cep_set_free(cep); > - siw_cep_put(cep); /* put last reference */ > + siw_cep_set_free_and_put(cep); /* put last reference */ > > return -ECONNRESET; > } > @@ -1753,8 +1753,7 @@ int siw_reject(struct iw_cm_id *id, const void > *pdata, u8 pd_len) > > cep->state = SIW_EPSTATE_CLOSED; > > - siw_cep_set_free(cep); > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > > return 0; > } > @@ -1889,8 +1888,7 @@ int siw_create_listen(struct iw_cm_id *id, int > backlog) > siw_socket_disassoc(s); > cep->state = SIW_EPSTATE_CLOSED; > > - siw_cep_set_free(cep); > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > } > sock_release(s); > > @@ -1924,8 +1922,7 @@ static void siw_drop_listeners(struct iw_cm_id *id) > cep->sock = NULL; > } > cep->state = SIW_EPSTATE_CLOSED; > - siw_cep_set_free(cep); > - siw_cep_put(cep); > + siw_cep_set_free_and_put(cep); > } > } > > -- > 2.35.3 Okay. Acked-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx>