From: Julia Lawall <julia@diku.dk>
To: benh@kernel.crashing.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH 2/5] drivers/macintosh/via-pmu.c: Add missing pci_dev_put
Date: Mon, 19 Nov 2007 09:03:48 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.64.0711190903100.19198@ask.diku.dk> (raw)
From: Julia Lawall <julia@diku.dk>
There should be a pci_dev_put when breaking out of a loop that iterates
over calls to pci_get_device and similar functions.
In this case, the return under the #else case of #ifdef HACKED_PCI_SAVE
should have a pci_dev_put, just as the return in the case where
HACKED_PCI_SAVE is true does.
This was fixed using the following semantic patch.
// <smpl>
@@
type T;
identifier d;
expression e;
@@
T *d;
...
while ((d = \(pci_get_device\|pci_get_device_reverse\|pci_get_subsys\|pci_get_class\)(..., d)) != NULL)
{... when != pci_dev_put(d)
when != e = d
(
return d;
|
+ pci_dev_put(d);
? return ...;
)
...}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
diff -u -p a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
--- a/drivers/macintosh/via-pmu.c 2007-11-18 20:43:10.000000000 +0100
+++ b/drivers/macintosh/via-pmu.c 2007-11-19 08:16:44.000000000 +0100
@@ -1896,8 +1896,10 @@ pbook_pci_restore(void)
pci_write_config_dword(pd, i<<4, ps->config[i]);
pci_write_config_dword(pd, 4, ps->config[1]);
#else
- if (npci-- == 0)
+ if (npci-- == 0) {
+ pci_dev_put(pd);
return;
+ }
ps++;
if (ps->command == 0)
continue;
next reply other threads:[~2007-11-19 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 8:03 Julia Lawall [this message]
2007-11-19 8:22 ` Benjamin Herrenschmidt
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=Pine.LNX.4.64.0711190903100.19198@ask.diku.dk \
--to=julia@diku.dk \
--cc=benh@kernel.crashing.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®