From patchwork Fri Dec 8 19:02:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Tan X-Patchwork-Id: 10103185 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 460A160325 for ; Fri, 8 Dec 2017 19:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3495C28EAF for ; Fri, 8 Dec 2017 19:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2636128EB9; Fri, 8 Dec 2017 19:02:42 +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 8E05B28EAF for ; Fri, 8 Dec 2017 19:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752431AbdLHTCk (ORCPT ); Fri, 8 Dec 2017 14:02:40 -0500 Received: from mail-sn1nam01on0068.outbound.protection.outlook.com ([104.47.32.68]:32301 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752338AbdLHTCj (ORCPT ); Fri, 8 Dec 2017 14:02:39 -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=eSaW6dXbtaDMByciG+imY7pY/WrrCQHb040SG1bmICx0HQw4SrRyQ6JK7IMFbEduG8pXIJQvY0eSZ3czJje7feuWKg8K5xma0SHAS4AKfDUtE6IBQgufuKZRhlO096E4jdrwP2IGPS2LFNJ763Xo6kawtu0mTMB9NXhitPtnUcU= Received: from bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com (208.91.1.34) by CO2PR05MB2773.namprd05.prod.outlook.com (10.166.200.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.2; Fri, 8 Dec 2017 19:02:37 +0000 Date: Fri, 8 Dec 2017 11:02:24 -0800 From: Bryan Tan To: linux-rdma@vger.kernel.org Subject: [PATCH for-rc 4/6] RDMA/vmw_pvrdma: Use refcount_dec_and_test to avoid warning Message-ID: <20171208190218.GA744@bryantan-devbox.prom.eng.vmware.com.prom.eng.vmware.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171208185818.GA28514@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: YQXPR0101CA0063.CANPRD01.PROD.OUTLOOK.COM (52.132.74.40) To CO2PR05MB2773.namprd05.prod.outlook.com (10.166.200.25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d83a2545-1f7e-47a0-ce78-08d53e6e3fe2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:CO2PR05MB2773; X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB2773; 3:KaAwYGNHjdnQNUjeLAmKJJMQlgHwW69aBmoW9Z0Q5NovtkSRNyyCvIBDfMdQJoUaDRTDL3Am3i8eKJEp7F2zf4TXPyI/yn2qF6Wed1tweHaS8vJRMbuEhKH2NN9V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fRRmFwvlzwJvApzgdPr5vqs3YAdx6eWw95WgNjG3HmdhCWQlFsAcqSAB1BBD9FurKe31ebpt04rFX3XvCIvBrozy97Of8vMRsuEwU3EcDiy2xoeKliGYat42KJiS7nE/kqVfrdS53Otk30s0bd6RZ0EFV/g6zmppXb7RTQeVoB9oAfuXM1wACjFDgAs0w/JvRpwaeisdUQM+wMckwSwJhD9PT8M5dqgmiEdT+NM3vNWyvyVc22JFLklE3EwiPK9914Ez8LmUdk1Fqbk1dacRcE51CaVMzCbj7i3b; 4:hNmO1CS/8f0ev1dziIAnp78LrNrVdbN6d7admk9SqNNGl+0d2k/LRVzzPj5C6atIDyyyAhArefHVP6FOeA03aOfzeeV2q2NhyFYeAA0CMd1RdPG1KEv+/6q5Y4Y9pn5pEFY6qLLHDXZ/qTdEA6FcNc4MGvykl7bsTRKdBH6LmWKnQNaMAPL5FhOgOhygvHtcm3OUNtA3LbdAbFxo1Hj7lkbRMsqkK8P9fq1299NYo7YI3PiSMRNbPhobU3G0/IOz93lG5fi2lg6xBvKU/qBuWKz4HXcLFca4YPyIQR1thm/rlriXLUCgEUWxqibYNJs5 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)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(6072148)(201708071742011); SRVR:CO2PR05MB2773; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CO2PR05MB2773; X-Forefront-PRVS: 0515208626 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(189003)(199004)(478600001)(50466002)(47776003)(6666003)(2950100002)(66066001)(5660300001)(6916009)(8936002)(25786009)(2906002)(33656002)(53936002)(97736004)(6116002)(16526018)(7736002)(105586002)(86362001)(305945005)(81156014)(81166006)(68736007)(316002)(2361001)(1076002)(2351001)(16586007)(3846002)(23726003)(58126008)(55016002)(52116002)(106356001)(83506002)(7696005)(8676002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR05MB2773; 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; CO2PR05MB2773; 23:5g3TFVRzYVMQIaRPjp7VJaytFg8TfDpFCnprVEvFO?= =?us-ascii?Q?CHqQevw17IRStz/t3Nj0qiAVXIEqmS2dACi7CBFp6QdnRWweC46K2D8mELv0?= =?us-ascii?Q?yGPw+bdDF44QgEklEdFOaJjNGTXFxbHTs+Z2IYStdRBUWjcGESOIeYHx8QTm?= =?us-ascii?Q?oHrXAYh3uzw+5zBRzpb8wNwgxCIeq9EM3EVuVDUgrJvM3NWT9guOIP1lVGxq?= =?us-ascii?Q?rKVQNEGJ6hqiDvFIgTU3kn0idvJZeRn3cmsbA6sq/XUQQwBgzOl5JJLDtCO/?= =?us-ascii?Q?NRQSYL++4RbATs3aKqRzS47M0/1jiMt8IXaasxcz5wxpbngoLaBVVA2g9U7A?= =?us-ascii?Q?FKhhoXZYm3UvFKTI4X6N7TdQ+TOXsYF5dB+aYor0BJhsdhnxncmNd6EFHUV2?= =?us-ascii?Q?KGmzcBJze493pq39L8jdWZRVHFabnFxgSn9uxtnBPBL5ozDOtkN0NcsTBEvY?= =?us-ascii?Q?VDOGkVoMtHPgRXoer4ydzjb9lBIKYyVep3bsnrjYEVmX1wJDJ4x3eSbbUlSw?= =?us-ascii?Q?dH7Jsy97Eo7D41VWJ4YI7BEygoxubS5TnNZKyYbzpOSES676ikufY9Wliwjb?= =?us-ascii?Q?+AxUmcZckOHOWV6l6zjfN6BTnv/ez/9A4tBEhKLvQSOcD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ECALrcGN4XlnauTdS2l+x348XDAhV9qpICQ=; 24:8HHjj8uMqQJydV9JNM2HWV9y6R7IT9J4mEjMxshOzyKK3uvDGm7ywrP1F41zwgIooEUrFjs24OdFBhXc5FE0BGwYqVou6vjKCeeDO9M3FPc=; 7:UU14OcFr3r7PBMXr1gsgy3vSvxbJhlD94+WU08Hk4CZPfsPMZgMevlvgk/r0dXMNG7ZtMj9YYOBKNrlaSbcIyUGMs9qjG9vgkcq8wwNPnJmtqHbrD9fCsKf7FgjoazebsOmi0HhnziFzQ+Da9gWQrW1J+6Nw5XxQU2uBXcHFeE7V5VXcsAdxaABVBsLNkBdcZ1bLIE7mzbIQxc1yHAoTZEwXAjfLC8yEIscrOz4OvPzCVp1437WqHE3QmO2BUyHu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB2773; 20:wLGqTOkMXsopy6gyzRyanI4ut2W+jrQ11VrKg6FsdbiGQGHgKK4O09/+6NhJOgKdZKrVdQthCVYRPYczJtSQDYBAjqaBgMnZR2qdcSXNFcvyxaUXnhgRorwIo4kKQpywq5wX6/BlK3TrDL8ehfJAR9xOJSQK7knFNVM3V4upfDI= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2017 19:02:37.5852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d83a2545-1f7e-47a0-ce78-08d53e6e3fe2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR05MB2773 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);