From patchwork Wed Feb 8 21:14:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9563413 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 0B32D601C3 for ; Wed, 8 Feb 2017 21:14:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 852DC284F6 for ; Wed, 8 Feb 2017 21:14:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 777B228511; Wed, 8 Feb 2017 21:14:54 +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=-6.9 required=2.0 tests=BAYES_00,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 33A8E284F6 for ; Wed, 8 Feb 2017 21:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751855AbdBHVOj (ORCPT ); Wed, 8 Feb 2017 16:14:39 -0500 Received: from mout.web.de ([212.227.15.14]:63018 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbdBHVOh (ORCPT ); Wed, 8 Feb 2017 16:14:37 -0500 Received: from [192.168.1.2] ([77.181.90.255]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lk8T4-1bzTex1lWM-00cAux; Wed, 08 Feb 2017 22:14:21 +0100 Subject: [PATCH 04/14] RDMA/cxgb4: Use common error handling code in recover_queues() To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Wed, 8 Feb 2017 22:14:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> X-Provags-ID: V03:K0:m8dSMPqc/Ei/kmAsVb7tNGDTxjwDZ1lXGT+IHPZmQl+3RgfxK7p 2SpqtUEqPdyFoB+Le/oQEa8/P46XhSEacNrWEpdiFpmHqP+RyGsU+hCO3sQVWUF3cK+ZLZ1 wct2idp7oTYV1pBgr7IEZY1J20C5/4RywV7iq68+L1alMHjEOfmXipIqBDFOmiHvSOmhhs+ R+2PL6BQekkypwMhEsbnw== X-UI-Out-Filterresults: notjunk:1; V01:K0:GnMsSVUUqlY=:4TBy9bGTRwgNrqs5Zo5Vc+ wZUSFUAPlKcly2HRr8drr2CCN/3wDGbFl1HL9heUvmOOzzBjBb+4/6RYaICxMH1hSz+XUQyyY FVHiLew5Qtu2k1K/vOlHaBQETKpNH0TxV+odBH+9dyrrc8MAbuYzICt4LxCyOPH/UqNhde9H6 yuj+J247lChORjR7h3NkFPT+Ii1fRY+XuUaQHmh6Rlk8J4hjC6KFXvYJuw2sW1tXL8VDyJzX8 X1hfjc0qGDVx+i5mKQQwygtDMGaKlzNs7wtXumf4IA4mMp1t2vZLX9cO7kNDps1DgRoDB2dgj 1ITvbZZmIw224FUBLGzuR6cXWfx3NMNb7LopCy0+6yMxyIFpRJu4ABTvDbXTFUQzWUG1WHawX aR/Ig31lLHWUQWjxSVHnDf2zk0Q9Q+c72V56owdXEx2GxskTsS1zS4x2nLwvtdlqqNvRwP19H mduQlOqi5girZSB8LBVrhk91j36WU5WnaOKU+zzLLPxVgMWUGJ3c2UbKG7KplnkBwPfWQJWc9 R6WtaB12OLeL4sv7SzI4GXBcRJfeHAMiVe06UV/d1FehH74ZZvlwMEYKGtvWEDn2lnIQJ3jmB LtUZBBLDZukfqNChRCTQq2Pt11TSJnPfOHhYngrUVYD1VsI6j7fSii+Ev673E6kRMoo5gnlW8 OitgtCdBP64bBgPeaEKxIehWhjGjuC6Ct9EGzZVpP2scM++xGVVg3MxW15RwePc3e2W0MyExh ys9tjS7L7tZha79YCF3sjWWJLQRXcnuFZz6zncoSHhx7rWtZIFzjvyChuLfvNRJ+VlzM/jtYc Apxw2Zl 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 From: Markus Elfring Date: Wed, 8 Feb 2017 15:51:58 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/cxgb4/device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 444c28206dae..46410c4a9afb 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -1467,10 +1467,9 @@ static void recover_queues(struct uld_ctx *ctx) idr_for_each(&ctx->dev->qpidr, count_qps, &count); qp_list.qps = kcalloc(count, sizeof(*qp_list.qps), GFP_ATOMIC); - if (!qp_list.qps) { - spin_unlock_irq(&ctx->dev->lock); - return; - } + if (!qp_list.qps) + goto unlock; + qp_list.idx = 0; /* add and ref each qp so it doesn't get freed */ @@ -1488,6 +1487,7 @@ static void recover_queues(struct uld_ctx *ctx) spin_lock_irq(&ctx->dev->lock); WARN_ON(ctx->dev->db_state != RECOVERY); ctx->dev->db_state = STOPPED; +unlock: spin_unlock_irq(&ctx->dev->lock); }