From patchwork Thu Oct 26 16:12:31 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: 10028611 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 7375360375 for ; Thu, 26 Oct 2017 16:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63D9428E86 for ; Thu, 26 Oct 2017 16:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5896F28E88; Thu, 26 Oct 2017 16:13:13 +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 0C9B828E87 for ; Thu, 26 Oct 2017 16:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932377AbdJZQM7 (ORCPT ); Thu, 26 Oct 2017 12:12:59 -0400 Received: from mout.web.de ([212.227.17.11]:56556 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932255AbdJZQM6 (ORCPT ); Thu, 26 Oct 2017 12:12:58 -0400 Received: from [192.168.1.2] ([78.48.35.118]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MfqEy-1dmwcx1bNs-00NCPE; Thu, 26 Oct 2017 18:12:35 +0200 To: linux-rdma@vger.kernel.org, Dennis Dalessandro , Doug Ledford , Hal Rosenstock , Leon Romanovsky , Sean Hefty , Yishai Hadas , Yuval Shaia From: SF Markus Elfring Subject: [PATCH] IB/mlx4: Use common error handling code in __mlx4_ib_create_flow() Cc: LKML , kernel-janitors@vger.kernel.org Message-ID: <0bcea3cf-91e3-01d5-8d80-34cd6b611fb1@users.sourceforge.net> Date: Thu, 26 Oct 2017 18:12:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:UWZDZZRCt+30Z3fmPAK547V4NZEWt7QKYSxGjanlbgqCtToDsqO +X1NIJDWt/vZFsh98SCarDwXSa6TENFHHcAtRR1bARh0zV7S4mB8jLCOBg3hwK6kXz4BdVi I+yOlT5/aFQN7BJtQ0BIwOuyxiSMD9AD78pVoITMG5Twt4HNnQl+E8e4HwpdkUaa6HgJtBU 8aoEEVPsLXmHTBN92faag== X-UI-Out-Filterresults: notjunk:1; V01:K0:i+PqXkaN/SI=:al4l7717nNeogYRpEvrKo1 Foip1gU81mPsCauvKTHrr/nQpbToJalE2HiOJE5bQTLVC6f9PD6vM+z+OKNyT9+08N10DlAOK kIlme28F0EIUCIJ9LlA8rgcy7C0n+crjJLBIRdbMibcddHxFmEGzGqE0QyNbDIrwV5W3eYG5k SeyUqVC0nPvplze73xOOoJg6oZGHbl8Jv2OgKMGsPhPi3k0wjWQPMfy9//POABm8Fuoj5fLcj cYgW47eeFsittVuB/cMkuJdK2J3f6nA1n0s0/3i9IpkVKlANjmVsHLKO4nI+5/AE0qx2REQz+ Mpw2I13m6F4rYHARdf7cVJNAcOHMShrOeF7Ejn7I/bJXXXsIOrLKPm3gfoTq4wkweK3Ez9L7H 2ubi5SGAxxFeRaAvZ2qh/nHZyTeJ3m3SK0s9HN+Ww1fosLC1tKZyjYUHq2meTn1fYWPGgGwJi E/utkzb7hjwDdodxe7p2ZkHZROvwYkws31ceAbceSuaIj7vm7F4PHPft7+kaCg0X9sCawzv9q i0e9mRxF5uFkBBUMq5dtiJ4FObdIVI4j4SYaDsw6YIgDHSjbLklEG5aZauRBDegRzwluT2wzq /bijWAqMwLdY2GUvW2sAJYcs/ZUxHBKLbN1OkgVIHWi/jxFQR6Gbbtzp3XDad4rRwoiPsKOly PVP/Cn2kJs8rhD12YbNJBqvXhvo/qUPlBA8rB7Imrz7axgqRhI6W7RXH9tEfB1SaowMuICc0l AGVvXrG61p4U0O6k80sohsTIfTbQkq1r3+iMv137yQKbe7Vug92EOddcw9NAQlgQHMSWKIkMN PvJ09Cd6vEYqukF632vvEG6fRHRU+8nbcF6Pqac2IggC77L2ow= 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: Thu, 26 Oct 2017 17:54:15 +0200 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/mlx4/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index c636842c5be0..4a598c48ea1c 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -1691,8 +1691,8 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att mdev, qp, default_table + default_flow, mailbox->buf + size); if (ret < 0) { - mlx4_free_cmd_mailbox(mdev->dev, mailbox); - return -EINVAL; + ret = -EINVAL; + goto free_mailbox; } size += ret; } @@ -1700,8 +1700,8 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att ret = parse_flow_attr(mdev->dev, qp->qp_num, ib_flow, mailbox->buf + size); if (ret < 0) { - mlx4_free_cmd_mailbox(mdev->dev, mailbox); - return -EINVAL; + ret = -EINVAL; + goto free_mailbox; } ib_flow += ((union ib_flow_spec *) ib_flow)->size; size += ret; @@ -1726,7 +1726,7 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att pr_err("Device managed flow steering is disabled. Fail to register network rule.\n"); else if (ret) pr_err("Invalid argument. Fail to register network rule.\n"); - +free_mailbox: mlx4_free_cmd_mailbox(mdev->dev, mailbox); return ret; }