From: Brian Gerst <bgerst@didntduck.org>
To: shaohua li <shaoh.li@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, greg@kroah.com
Subject: Re: [PATCH] call 'pci_dev_put' after pci_get_device
Date: Mon, 25 Oct 2004 09:37:04 -0400 [thread overview]
Message-ID: <417D0180.5040401@didntduck.org> (raw)
In-Reply-To: <288dbef704102502474fdd0c84@mail.gmail.com>
shaohua li wrote:
> Hi,
> Some code didn't call 'pci_dev_put' after pci_get_device. Below is an
> incomplete list.
>
> Thanks,
> Shaohua
If pci_get_device() is passed in a non-NULL dev it internally does a
pci_dev_put(). So if you do a complete while loop (ie. no breaks, gotos
or returns), pci_dev_put() is unnecessary.
>
> Signed-off-by: Li Shaohua <shaoh.li@gmail.com>
>
> ===== drivers/pci/pci.c 1.73 vs edited =====
> --- 1.73/drivers/pci/pci.c 2004-10-07 00:42:55 +08:00
> +++ edited/drivers/pci/pci.c 2004-10-25 17:30:36 +08:00
> @@ -734,6 +734,7 @@ static int __devinit pci_init(void)
>
> while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
> pci_fixup_device(pci_fixup_final, dev);
> + pci_dev_put(dev);
> }
> return 0;
> }
> ===== drivers/pci/quirks.c 1.55 vs edited =====
> --- 1.55/drivers/pci/quirks.c 2004-10-20 00:54:38 +08:00
> +++ edited/drivers/pci/quirks.c 2004-10-25 17:29:48 +08:00
> @@ -38,6 +38,7 @@ static void __devinit quirk_passive_rele
> dlc |= 1<<1;
> pci_write_config_byte(d, 0x82, dlc);
> }
> + pci_dev_put(d);
> }
> }
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release
> );
> ===== drivers/pci/setup-irq.c 1.5 vs edited =====
> --- 1.5/drivers/pci/setup-irq.c 2004-10-07 00:44:51 +08:00
> +++ edited/drivers/pci/setup-irq.c 2004-10-25 17:29:08 +08:00
> @@ -67,5 +67,6 @@ pci_fixup_irqs(u8 (*swizzle)(struct pci_
> struct pci_dev *dev = NULL;
> while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
> pdev_fixup_irq(dev, swizzle, map_irq);
> + pci_dev_put(dev);
> }
> }
prev parent reply other threads:[~2004-10-25 13:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-25 9:47 [PATCH] call 'pci_dev_put' after pci_get_device shaohua li
2004-10-25 13:37 ` Brian Gerst [this message]
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=417D0180.5040401@didntduck.org \
--to=bgerst@didntduck.org \
--cc=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shaoh.li@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox