[PATCH 01/13] staging: gasket: core: hold reference to pci_dev while used

Dmitry Torokhov dtor at chromium.org
Tue Jul 31 06:18:49 UTC 2018


On Sun, Jul 29, 2018 at 12:37 PM Todd Poynor <toddpoynor at gmail.com> wrote:
>
> From: Todd Poynor <toddpoynor at google.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 at google.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);

gasket_free_dev() is called only from driver PCI probe and remove
function. I can assure you that that pci_dev structure is not going
anywhere, there is no need to take this additional reference.

Thanks,
Dmitry


More information about the devel mailing list