From patchwork Fri Jul 6 16:45:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10512133 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 340F6603D7 for ; Fri, 6 Jul 2018 16:45:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2620928640 for ; Fri, 6 Jul 2018 16:45:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A2362866C; Fri, 6 Jul 2018 16:45:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A03C928640 for ; Fri, 6 Jul 2018 16:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933561AbeGFQpe (ORCPT ); Fri, 6 Jul 2018 12:45:34 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:4381 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933402AbeGFQpd (ORCPT ); Fri, 6 Jul 2018 12:45:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530895533; x=1562431533; h=from:to:cc:subject:date:message-id; bh=QxXjv/+KbOnExFTL+SPHYI001EynPH1vCHDMx9M5O5U=; b=ImpyXhpYk8D8tYNxamgiNOXMlLWnMpI2BXkDdZex/DiXdjgkVpSJkKky e6LsnFkfEkvi6LyzXiLpfkVokPMI1dCfj/8fFtI+BI/fPfFybXbK3il37 y0C6yNYevaivFKyBHCLTvIfPOU/1TEyeDhKeXDbtwIE1QtMky/INajd2Q FuCTEPP1xKLZpkNbENlTNcBCt1G/Vgo8JvmI4wwLmcUIdwWsbvn/k6fzg uRBCgdY15h3YfmPSMmN8aqBrz/PPSWD/+TQjQav77VXRFsRicvYTr0izf ZjviV9wiS4EiqEDc3F1k1bJJB6ZLEIs8RdGgmP4WcArL/26/g6S4MngYm g==; X-IronPort-AV: E=Sophos;i="5.51,316,1526313600"; d="scan'208";a="84678371" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Jul 2018 00:45:33 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 06 Jul 2018 09:34:44 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip02.wdc.com with ESMTP; 06 Jul 2018 09:45:33 -0700 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche , Parav Pandit , Leon Romanovsky Subject: [PATCH v2] RDMA/rxe: Simplify the error handling code in rxe_create_ah() Date: Fri, 6 Jul 2018 09:45:32 -0700 Message-Id: <20180706164532.10900-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch not only simplifies the error handling code in rxe_create_ah() but also removes the dead code that was left behind by commit 47ec38666210 ("RDMA: Convert drivers to use sgid_attr instead of sgid_index"). Signed-off-by: Bart Van Assche Cc: Parav Pandit Cc: Leon Romanovsky Reviewed-by: Leon Romanovsky --- Changes compared to v1: implemented Parav's suggestion to change the "goto err1" statements into "return ERR_PTR()". drivers/infiniband/sw/rxe/rxe_verbs.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 1272903d0fe3..0ea394554c8e 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -241,24 +241,17 @@ static struct ib_ah *rxe_create_ah(struct ib_pd *ibpd, err = rxe_av_chk_attr(rxe, attr); if (err) - goto err1; + return ERR_PTR(err); ah = rxe_alloc(&rxe->ah_pool); - if (!ah) { - err = -ENOMEM; - goto err1; - } + if (!ah) + return ERR_PTR(-ENOMEM); rxe_add_ref(pd); ah->pd = pd; rxe_init_av(rxe, attr, &ah->av); return &ah->ibah; - - rxe_drop_ref(pd); - rxe_drop_ref(ah); -err1: - return ERR_PTR(err); } static int rxe_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr)