All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Ping Fan <kernelfans@gmail.com>
To: linux-pci@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count
Date: Tue, 12 Aug 2014 08:31:21 +0800	[thread overview]
Message-ID: <1407803481-7910-1-git-send-email-pingfank@linux.vnet.ibm.com> (raw)

As the notes of this function, pci_get_domain_bus_and_slot() should
increase the reference count.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 drivers/pci/search.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 827ad83..41a5738 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -258,8 +258,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
 
 	for_each_pci_dev(dev) {
 		if (pci_domain_nr(dev->bus) == domain &&
-		    (dev->bus->number == bus && dev->devfn == devfn))
+		    (dev->bus->number == bus && dev->devfn == devfn)) {
+			pci_dev_get(dev);
 			return dev;
+		}
 	}
 	return NULL;
 }
-- 
1.8.1.4


             reply	other threads:[~2014-08-12  0:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12  0:31 Liu Ping Fan [this message]
2014-08-12  1:43 ` [PATCH] pci: bugfix, pci_get_domain_bus_and_slot() needs to inc reference count Yijing Wang
2014-08-12  4:36   ` Liu ping fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407803481-7910-1-git-send-email-pingfank@linux.vnet.ibm.com \
    --to=kernelfans@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.