From patchwork Wed Jun 15 15:26:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Metzmacher X-Patchwork-Id: 12882572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CF7AC43334 for ; Wed, 15 Jun 2022 15:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233084AbiFOP3J (ORCPT ); Wed, 15 Jun 2022 11:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356184AbiFOP2p (ORCPT ); Wed, 15 Jun 2022 11:28:45 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF1FF51 for ; Wed, 15 Jun 2022 08:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-Id:Date:Cc:To:From; bh=EklZFP4aFAqi/lEclxMAM1al3UCe/uBglyUeYgxdUa0=; b=j6sPsSbaWYnE6zXWlIdbyZfjVz JE4G2bfNdgonsaCxCHvyNn77O874Rmc47CpxPOHmLPAWzPxuZbHH7sDcdPXwrhOaYDPnsX9Xg3OYu GHWbmnW8en6eFjcfBsFKKJUUpNM2IyJDbFfJAc/XI/Gk3+8hCcesbCC/i2C8KlojKYhV20+WFgTlZ 6ZVi0FZhM/6fWabaGQT5pkTYVqcsyuHcOEWpVwmTqBs7tcvA8yl4dSPajBd3sh/xpWX9XUGGYfSOi DWySIRStqFFELbIaUuBk+ZwqXwT9k/blShHH3fctngYAu2sL+3CL75SyFD2whMxvoQQRrn4JdbeUI 9XulB573oJe0u/fjfjnfPVsRFd4PfMuyufU6MDd4eY+BZxN/XsZ1AcEX8jvJC5g4ebH1xpyMWERF7 9cWrmGfaBx73Ap5ZKIl6mtmJY1HsIuhxldTVVWxBIzQFieBaYN7FyP/kwql8DLueIiRb1JCK9V0PN detUKQ5QL2euU1ySpNM2Ti5B; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__ECDSA_SECP256R1_SHA256__CHACHA20_POLY1305:256) (Exim) id 1o1UwM-005rvx-FF; Wed, 15 Jun 2022 15:28:18 +0000 From: Stefan Metzmacher To: Bernard Metzler , linux-rdma@vger.kernel.org Cc: Stefan Metzmacher Subject: [PATCH v2 11/14] rdma/siw: use error and out logic at the end of siw_connect() Date: Wed, 15 Jun 2022 17:26:49 +0200 Message-Id: <5da05688aba3d09db5c46a80915f13729c807245.1655305567.git.metze@samba.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org This will make the following changes easier. Fixes: 6c52fdc244b5 ("rdma/siw: connection management") Signed-off-by: Stefan Metzmacher Cc: Bernard Metzler Cc: linux-rdma@vger.kernel.org --- drivers/infiniband/sw/siw/siw_cm.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index 307494c6707a..66d90fc77cef 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -1502,14 +1502,19 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) cep->mpa.pdata = NULL; } - if (rv >= 0) { - rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); - if (!rv) { - siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp)); - siw_cep_set_free(cep); - return 0; - } + if (rv < 0) { + goto error; + } + + rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); + if (rv != 0) { + goto error; } + + siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp)); + siw_cep_set_free(cep); + return 0; + error: siw_dbg(id->device, "failed: %d\n", rv);