From patchwork Thu Dec 14 00:23:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Tan X-Patchwork-Id: 10111257 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 6486960327 for ; Thu, 14 Dec 2017 00:23:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5390127EED for ; Thu, 14 Dec 2017 00:23:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4590328946; Thu, 14 Dec 2017 00:23:32 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 B897027EED for ; Thu, 14 Dec 2017 00:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751026AbdLNAXa (ORCPT ); Wed, 13 Dec 2017 19:23:30 -0500 Received: from mail-dm3nam03on0043.outbound.protection.outlook.com ([104.47.41.43]:7481 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750795AbdLNAXa (ORCPT ); Wed, 13 Dec 2017 19:23:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vEt081Jr2RCZe2qt62o1C/vNkfSTzotfaBehAhkxoEk=; b=XL8qNG4/WZo3WuAEyhgq48z+mr+5zewx9EAx3hi3buDg6ww4R9LaElyTczyB99ARUo7F4Qm5+U/NpfvNCR7MlYGyiPBo6+nZJ0A96F+nBm2YCIXqqueNrs4qV4UR9EeJs1OAzlCrcPjdWRtIxXK7zIVfxbf4PvanbNJETebaMNU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bryantan@vmware.com; Received: from bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com (208.91.1.34) by SN2PR05MB2782.namprd05.prod.outlook.com (2603:10b6:804:16::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.2; Thu, 14 Dec 2017 00:23:27 +0000 Date: Wed, 13 Dec 2017 16:23:10 -0800 From: Bryan Tan To: linux-rdma@vger.kernel.org Subject: [PATCH v1 for-rc 4/8] RDMA/vmw_pvrdma: Use refcount_dec_and_test to avoid warning Message-ID: <20171214002300.GA15148@bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171214001753.GA9780@bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: VI1PR09CA0084.eurprd09.prod.outlook.com (2603:10a6:802:29::28) To SN2PR05MB2782.namprd05.prod.outlook.com (2603:10b6:804:16::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d2c73454-6a6a-4ccb-ac31-08d54288e5f0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307); SRVR:SN2PR05MB2782; X-Microsoft-Exchange-Diagnostics: 1; SN2PR05MB2782; 3:3DIsw3Nt43kBQcEnyUWS5WjO1MGK0Lm7cKbV430uBX374n1mz47HEZTCNOSGXlHC5CM5Z3FGvmaNILV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GTaPOZKJYz/jDBlT5K9jSPqKOdnMQEOiq4up4R5rNhPO0fRPIG2Txr3o+ff6jlLkSQVE9g62x1uCK+rMquzirJp9bitGMQMHdzunbKQvo+DZFuQxWrG+y4HL/BmUB/wMH7nwerBBy/HGSlZQEEx1Qa4Y/ipm1bE7Y/ujGQADJDcxoviCGE/uUa/vW6FYXxlv9EMzJnCo1yi9UpPbyWruEqnLqrojr173vW5/08izoEzOrmnqc2AKDzwlQJGrRRyTSCEOH5LqIrdER8uGz5n; 4:iS/MI/WO3d8Om5+X9NAvg+rMduHJo2WcDio3567eoVJHJlQGwLp3N1OVQq2j2OCuquvT5ZSp3T4dXhcwH8ga9heMz+qwNCCBj6Zoq/XkEKxLFZ5WQu3lf1peiOt6B4cbyX4nbyfqPjYEpgwBJ9eX1bjQqddbU6E8mRzd37o5JTlb2qnnRt5KC/qWhMX0/xI3eEq6yNS25ayjWsw0bopRq3/0Ul3B1L/oNGBCscPXmtZkuD9/4zXzqOFtteQAEK89ZRe7Nav7qHKvUMPrL+brd4/2k4yseAoj9H+SWW7VNqT+cd6sWn66xqClWAxApcw8 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231023)(3002001)(93006095)(93001095)(6041248)(20161123555025)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011); SRVR:SN2PR05MB2782; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN2PR05MB2782; X-Forefront-PRVS: 05214FD68E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(376002)(189003)(199004)(6666003)(6916009)(2950100002)(58126008)(386003)(59450400001)(316002)(33656002)(16526018)(105586002)(16586007)(97736004)(55016002)(81156014)(81166006)(106356001)(8676002)(2351001)(2361001)(478600001)(83506002)(52116002)(7696005)(50466002)(5660300001)(1076002)(53936002)(23726003)(68736007)(86362001)(47776003)(7736002)(305945005)(2906002)(25786009)(3846002)(66066001)(6116002)(8936002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR05MB2782; H:bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR05MB2782; 23:svmWhlQWfbwRKRw0p/ZQV+lfyacFElr0UcB1QhgLN?= =?us-ascii?Q?kQ9zb+YavWjKE06fixEGSyXfMPs0zK8HLGvlXI7P/zokK5KoBTJwOVtbWV1C?= =?us-ascii?Q?AK/PJcREwqqHcIjnQYbMXPH6rSW/ZB8tVDZktrknBJCfgTYsJo9MIYCmNgFm?= =?us-ascii?Q?VIJWXR1w4D9lBsBMzHskWXB1Qh4JvOWcUhGDzYvCOeUhOYawfEiOwK/8+pSr?= =?us-ascii?Q?shlVkNBIlW9SpRYGZ53hc5je/WSs9Ng7e0lk0h+/HrLY+96SbaYQuM2OBgLC?= =?us-ascii?Q?+FMm2U8DH/ZwtcOcaXUbqR6j7qS1nuTo4IMuH/3J4pH4ccogiNToxGgoutV4?= =?us-ascii?Q?s160oYwQHTP6IpreUYItMl6U46lw30rGw6JcJrFXMNdmLSuvhDC5yrFmQbXY?= =?us-ascii?Q?ojjYZ/r+PlFWquz/4dqeeJeSHyOsoEK2dWMa79OlUf1E3XeB+ih44wCOr3RZ?= =?us-ascii?Q?rZ2CeezrtFcEKiu+DhxWF4BHqnwDRjHFgQAKxNkp34gr5JmD+QNNYhFU+HGc?= =?us-ascii?Q?nELiZ0L8OARbJM66hhDePg3A2mXioJxihA4F5/xo576PH9WMZ3Xri3cxcM3j?= =?us-ascii?Q?vmBFhFJQBpCDhUxULu8JgBPjb4J1pD5NWHAoR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O3mLjg5a1JD/Eo98ls3LR8B7yqNGoxzhdnsxEy0/97pPktQB5WB8Mn21jw3ATWA35pSA7DJiKDMVfeC+l3z9YKsFqfo2Dn9G06ZH0n2MYfUNJaRQ8/6E/rEP08xo8=; 24:Ygw5hkxUjzun1cOKcpVjXyyzi0Wwp9R5+/+sDx5+ue7NA+/elWsBUCfjk73g206f+e7wJJT7KM3KvI6Es8SZy3bco5Ak/T87M3DrM/2+/nw=; 7:qJB6EFy/omIL3QqXW3x3OjzVgluysfObCMq8jw9agdi6rvIkAHp42LG39nwx6hCmpCYlvjP9RFvYOPb/OmaDECazsmFblrc0TOVBni7y7zce86aZZIkBRIIUOTN3iARDjMJgo/QpY1BcsNfoN73mY3fb36FrBuuaJ38PBRokt8Op5Bf44jduOCsqQKoOR3o7SkVpr61G1SsG7zkZncLASuQ+d27lnbbCftphKforti8JrLBSM6ohGLFUHZRAOgsF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN2PR05MB2782; 20:MJ4k5LXXrct6Ep5AXJfOgXXloMOnedrOQvdTjvaTECt+SpJT4dSgf+WlOe3pkGCgBYjdiM91Y4/JY2bVqjH12lbsMWxQj4/oSAC8SUxbcKFe1DNt4KBvthUlxw7clRB0zbsAU7CFNDEfqEG/nIrsUlgPNeDlNcpRIn5+P6kO5Nw= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2017 00:23:27.1664 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2c73454-6a6a-4ccb-ac31-08d54288e5f0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR05MB2782 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 refcount_dec generates a warning when the operation causes the refcount to hit zero. Avoid this by using refcount_dec_and_test. Fixes: 8b10ba783c9d ("RDMA/vmw_pvrdma: Add shared receive queue support") Reviewed-by: Adit Ranadive Reviewed-by: Aditya Sarwade Reviewed-by: Jorgen Hansen Signed-off-by: Bryan Tan --- drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c index 826ccb8..a2b1a3c 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c @@ -236,8 +236,8 @@ static void pvrdma_free_srq(struct pvrdma_dev *dev, struct pvrdma_srq *srq) dev->srq_tbl[srq->srq_handle] = NULL; spin_unlock_irqrestore(&dev->srq_tbl_lock, flags); - refcount_dec(&srq->refcnt); - wait_event(srq->wait, !refcount_read(&srq->refcnt)); + if (!refcount_dec_and_test(&srq->refcnt)) + wait_event(srq->wait, !refcount_read(&srq->refcnt)); /* There is no support for kernel clients, so this is safe. */ ib_umem_release(srq->umem);