From patchwork Mon Feb 18 14:23:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 10818107 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-2.web.codeaurora.org (Postfix) with ESMTP id 066481399 for ; Mon, 18 Feb 2019 14:23:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87A52AF0F for ; Mon, 18 Feb 2019 14:23:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCD132AF2A; Mon, 18 Feb 2019 14:23:45 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 D242B2AF0F for ; Mon, 18 Feb 2019 14:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390632AbfBROXm (ORCPT ); Mon, 18 Feb 2019 09:23:42 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:59458 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390383AbfBROXm (ORCPT ); Mon, 18 Feb 2019 09:23:42 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1IEE3YR049613; Mon, 18 Feb 2019 14:23:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=kD//jQcbWgOBUVoe4X2HAEt8EncpBu+lAlHy7JiYY+M=; b=2vQi1jhLYGfaVinXtM9IJPivlwzzj32gI90eLhHtAOFNrOhCFyyigNkpqpYhpwYBMyBp 9dVCcdqCwW3H6wobQmb6tG2otyzQDiS1ftBolmmVaywmDAZd9dff/zhaSf//2jgK8dEt ZkwZ1Oyhtly9WA0j+tD9taYIrggpqtXo6amK7OE8t4t/Fy/3ZeXYq/sMrqcBU0TMXYmj VvmpOLdl/gv6joO4lv5eiDF1mgwFBFhuGiaCEGBqAs01mMW5J7NPDtTiAjGT3G86/Zzg 0LsvcHIsDelkKybulqf+u15dJrYE6HVmTen0hX/YcQQxaBjEsji5K1vvwfBw5n5GSuQz uQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2qpb5r6cty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Feb 2019 14:23:34 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1IENXmR010964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Feb 2019 14:23:34 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1IENXVE012305; Mon, 18 Feb 2019 14:23:33 GMT Received: from lap1.nl.oracle.com (/10.175.43.151) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 18 Feb 2019 06:23:32 -0800 From: Yuval Shaia To: dledford@redhat.com, jgg@ziepe.ca, leon@kernel.org, yishaih@mellanox.com, matanb@mellanox.com, lariel@mellanox.com, linux-rdma@vger.kernel.org Cc: Yuval Shaia Subject: [PATCH v1] RDMA/core: Cosmetic change - move member initialization to correct block Date: Mon, 18 Feb 2019 16:23:22 +0200 Message-Id: <20190218142322.25572-1-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9170 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902180107 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 old_pd is used only if IB_MR_REREG_PD flags is set. For readability move it's initialization to where it is used. While there rewrite the whole 'if-else' block so on error jump directly to label and no need for 'else' Signed-off-by: Yuval Shaia Reviewed-by: Leon Romanovsky --- v0 -> v1: * Accept comment from Leon and rewrite the whole if-else block --- drivers/infiniband/core/uverbs_cmd.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index d4f1a2ef5015..66bdc2b32887 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -810,19 +810,18 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs) } } - old_pd = mr->pd; ret = mr->device->ops.rereg_user_mr(mr, cmd.flags, cmd.start, cmd.length, cmd.hca_va, cmd.access_flags, pd, &attrs->driver_udata); - if (!ret) { - if (cmd.flags & IB_MR_REREG_PD) { - atomic_inc(&pd->usecnt); - mr->pd = pd; - atomic_dec(&old_pd->usecnt); - } - } else { + if (ret) goto put_uobj_pd; + + if (cmd.flags & IB_MR_REREG_PD) { + old_pd = mr->pd; + atomic_inc(&pd->usecnt); + mr->pd = pd; + atomic_dec(&old_pd->usecnt); } memset(&resp, 0, sizeof(resp));