[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180729193646.201721-2-toddpoynor@gmail.com>
Date: Sun, 29 Jul 2018 12:36:34 -0700
From: Todd Poynor <toddpoynor@...il.com>
To: Rob Springer <rspringer@...gle.com>,
John Joseph <jnjoseph@...gle.com>,
Ben Chan <benchan@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Dmitry Torokhov <dtor@...omium.org>,
Todd Poynor <toddpoynor@...gle.com>
Subject: [PATCH 01/13] staging: gasket: core: hold reference to pci_dev while used
From: Todd Poynor <toddpoynor@...gle.com>
Hold a reference on the struct pci_dev while a pointer to it is held in
the gasket data structures.
Signed-off-by: Todd Poynor <toddpoynor@...gle.com>
---
drivers/staging/gasket/gasket_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 2b484d067c38a..b832a4f529f27 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -488,6 +488,7 @@ static void gasket_free_dev(struct gasket_dev *gasket_dev)
internal_desc->devs[gasket_dev->dev_idx] = NULL;
mutex_unlock(&internal_desc->mutex);
put_device(gasket_dev->dev);
+ pci_dev_put(gasket_dev->pci_dev);
kfree(gasket_dev);
}
@@ -565,6 +566,7 @@ static int gasket_pci_probe(
ret = gasket_alloc_dev(internal_desc, parent, &gasket_dev, kobj_name);
if (ret)
return ret;
+ gasket_dev->pci_dev = pci_dev_get(pci_dev);
if (IS_ERR_OR_NULL(gasket_dev->dev_info.device)) {
pr_err("Cannot create %s device %s [ret = %ld]\n",
driver_desc->name, gasket_dev->dev_info.name,
@@ -572,7 +574,6 @@ static int gasket_pci_probe(
ret = -ENODEV;
goto fail1;
}
- gasket_dev->pci_dev = pci_dev;
ret = gasket_setup_pci(pci_dev, gasket_dev);
if (ret)
@@ -703,7 +704,6 @@ static int gasket_setup_pci(
{
int i, mapped_bars, ret;
- gasket_dev->pci_dev = pci_dev;
ret = pci_enable_device(pci_dev);
if (ret) {
dev_err(gasket_dev->dev, "cannot enable PCI device\n");
--
2.18.0.345.g5c9ce644c3-goog
Powered by blists - more mailing lists