From patchwork Mon Jul 3 11:09:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9822509 X-Patchwork-Delegate: bhelgaas@google.com 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 5A31160246 for ; Mon, 3 Jul 2017 11:10:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49D962817F for ; Mon, 3 Jul 2017 11:10:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C6D7283AD; Mon, 3 Jul 2017 11:10:00 +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, 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 C2C0D2817F for ; Mon, 3 Jul 2017 11:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754413AbdGCLJv (ORCPT ); Mon, 3 Jul 2017 07:09:51 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:43789 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753881AbdGCLJt (ORCPT ); Mon, 3 Jul 2017 07:09:49 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v63B9Xiu028451 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jul 2017 11:09:34 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v63B9WNC019308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jul 2017 11:09:33 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v63B9WLo022354; Mon, 3 Jul 2017 11:09:32 GMT Received: from mwanda (/154.123.122.26) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 03 Jul 2017 04:09:31 -0700 Date: Mon, 3 Jul 2017 14:09:19 +0300 From: Dan Carpenter To: Bjorn Helgaas , Christoph Hellwig Cc: linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] PCI: fix pci_try_reset_function() Message-ID: <20170701135323.x5vaj4e2wcs2mcro@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a reversed if condition so the function doesn't work. Fixes: e94fae7aeef4 ("PCI: Protect pci_error_handlers->reset_notify() usage with device_lock()") Signed-off-by: Dan Carpenter diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5b49d662f996..3bf28bf04c3d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4269,7 +4269,7 @@ int pci_try_reset_function(struct pci_dev *dev) if (rc) return rc; - if (pci_dev_trylock(dev)) + if (!pci_dev_trylock(dev)) return -EAGAIN; pci_dev_save_and_disable(dev);