diff options
author | Guoqing Jiang <guoqing.jiang@linux.dev> | 2023-11-13 19:57:25 +0800 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2023-11-15 15:58:14 +0200 |
commit | d9a5b48681315a5881cea24bc8f384da02828e88 (patch) | |
tree | 9b849d11cd72aa78c9e43ce3ac079bc8f14cde4d /drivers/infiniband/sw | |
parent | 788bbf4c2fc6e0c35bae9ed5068f484272539d3e (diff) | |
download | linux-stable-d9a5b48681315a5881cea24bc8f384da02828e88.tar.gz linux-stable-d9a5b48681315a5881cea24bc8f384da02828e88.tar.bz2 linux-stable-d9a5b48681315a5881cea24bc8f384da02828e88.zip |
RDMA/siw: Introduce siw_destroy_cep_sock
Add one helper to simplify code a bit.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310091735.oG7bTvLR-lkp@intel.com/`
Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Link: https://lore.kernel.org/r/20231113115726.12762-17-guoqing.jiang@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband/sw')
-rw-r--r-- | drivers/infiniband/sw/siw/siw_cm.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index 5c0f9f8bf3db..86323918a570 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -367,6 +367,15 @@ static void siw_free_cm_id(struct siw_cep *cep) cep->cm_id = NULL; } +static void siw_destroy_cep_sock(struct siw_cep *cep) +{ + if (cep->sock) { + siw_socket_disassoc(cep->sock); + sock_release(cep->sock); + cep->sock = NULL; + } +} + /* * siw_qp_cm_drop() * @@ -423,14 +432,7 @@ void siw_qp_cm_drop(struct siw_qp *qp, int schedule) } cep->state = SIW_EPSTATE_CLOSED; - if (cep->sock) { - siw_socket_disassoc(cep->sock); - /* - * Immediately close socket - */ - sock_release(cep->sock); - cep->sock = NULL; - } + siw_destroy_cep_sock(cep); if (cep->qp) { cep->qp = NULL; siw_qp_put(qp); @@ -1693,9 +1695,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) error_unlock: up_write(&qp->state_lock); error: - siw_socket_disassoc(cep->sock); - sock_release(cep->sock); - cep->sock = NULL; + siw_destroy_cep_sock(cep); cep->state = SIW_EPSTATE_CLOSED; @@ -1740,9 +1740,7 @@ int siw_reject(struct iw_cm_id *id, const void *pdata, u8 pd_len) cep->mpa.hdr.params.bits |= MPA_RR_FLAG_REJECT; /* reject */ siw_send_mpareqrep(cep, pdata, pd_len); } - siw_socket_disassoc(cep->sock); - sock_release(cep->sock); - cep->sock = NULL; + siw_destroy_cep_sock(cep); cep->state = SIW_EPSTATE_CLOSED; |