From patchwork Fri Dec 14 00:58:50 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: 10730181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E0C891E for ; Fri, 14 Dec 2018 00:59:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CCE72CB8F for ; Fri, 14 Dec 2018 00:59:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 312492CF0D; Fri, 14 Dec 2018 00:59: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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D015E2CB8F for ; Fri, 14 Dec 2018 00:59:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbeLNA7f (ORCPT ); Thu, 13 Dec 2018 19:59:35 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:36321 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728832AbeLNA7f (ORCPT ); Thu, 13 Dec 2018 19:59:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=zLGBwVTyJXSFjgtUclEDIl5ixcJEYdtxgHrj+6fG+1M=; b=CVw8mYjkzsNr fdYqsT8/1ABPiQCaBkG6uaEGgAQQGTz1CRO+xWSds2WfDIhc0IwRIRaUGw7LS9Q7Zy02I1qe1NaZB d1ojJCTALL7H6703j6iWev+M+XrmpeSeHeSbTNMS3gWwNf4okprSMD/pypezEu14uja6AZQ52X02A suOmsC6Ric8LhmTRW4Xv2Xr0mHrHlIdLYOmTmyMXhS491MekPRAtcSgviCGb6UN2vTcRwR4W5IgZn N61VOOlDFX+0vXABIO/JNU/RR/aEgZ5CLAxQ6zJa+Ld94XLkC4z3hFySQVeao+ulNX+Am/Vh8otPF zrS9uISYhHFLIfjgqAAxMQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gXbpB-000AHc-IX; Fri, 14 Dec 2018 01:59:30 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 05386C06BF; Fri, 14 Dec 2018 01:59:26 +0100 (CET) From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche , Sergey Gorenko , Max Gurtovoy , Laurence Oberman Subject: [PATCH 12/13] RDMA/srpt: Rework the srpt_alloc_srq() error path Date: Thu, 13 Dec 2018 16:58:50 -0800 Message-Id: <20181214005851.176412-13-bvanassche@acm.org> X-Mailer: git-send-email 2.20.0.405.gbc1bbc6f85-goog In-Reply-To: <20181214005851.176412-1-bvanassche@acm.org> References: <20181214005851.176412-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-S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NQl0N82pGAaFlBh9ydCic1KxHB/etGG+jKYi/tvO WyEnBy/PpUxgSFRPcWxJF+/bZGcrdi6P9WA8qPaxL9ILtEIqJpgLAx9UBkVVtWWC7u0df68W0InH /+bTMKNm38MHe3iJ5ql2Fx06AJIYSscySZesPRxtLbAe07w72Y8M1+Qa8Q/Annoe3C1wCMjQ1GK/ MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 does not change any functionality but makes the next patch easier to read. Cc: Sergey Gorenko Cc: Max Gurtovoy Cc: Laurence Oberman Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 2e3ba767e614..584cb81733df 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2936,10 +2936,8 @@ static int srpt_alloc_srq(struct srpt_device *sdev) srpt_alloc_ioctx_ring(sdev, sdev->srq_size, sizeof(*sdev->ioctx_ring[0]), srp_max_req_size, DMA_FROM_DEVICE); - if (!sdev->ioctx_ring) { - ib_destroy_srq(srq); - return -ENOMEM; - } + if (!sdev->ioctx_ring) + goto free_srq; sdev->use_srq = true; sdev->srq = srq; @@ -2950,6 +2948,10 @@ static int srpt_alloc_srq(struct srpt_device *sdev) } return 0; + +free_srq: + ib_destroy_srq(srq); + return -ENOMEM; } static int srpt_use_srq(struct srpt_device *sdev, bool use_srq)