* [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge
@ 2009-11-04 16:11 Jiri Slaby
2009-11-04 16:36 ` Alan Cox
2009-11-17 3:17 ` Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-11-04 16:11 UTC (permalink / raw)
To: jgarzik; +Cc: linux-ide, linux-kernel, Jiri Slaby
In via_init_one, when via_isa_bridges iterator reaches
PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is
found but rev doesn't match, pci_dev_put(isa) is called twice.
Do pci_dev_put only once.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
---
drivers/ata/pata_via.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 88984b8..520d5a3 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -526,7 +526,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops
};
const struct ata_port_info *ppi[] = { NULL, NULL };
- struct pci_dev *isa = NULL;
+ struct pci_dev *isa;
const struct via_isa_bridge *config;
static int printed_version;
u8 enable;
@@ -551,15 +551,13 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
if ((isa = pci_get_device(PCI_VENDOR_ID_VIA +
!!(config->flags & VIA_BAD_ID),
config->id, NULL))) {
+ u8 rev = isa->revision;
+ pci_dev_put(isa);
- if (isa->revision >= config->rev_min &&
- isa->revision <= config->rev_max)
+ if (rev >= config->rev_min && rev <= config->rev_max)
break;
- pci_dev_put(isa);
}
- pci_dev_put(isa);
-
if (!(config->flags & VIA_NO_ENABLES)) {
/* 0x40 low bits indicate enabled channels */
pci_read_config_byte(pdev, 0x40 , &enable);
--
1.6.4.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge
2009-11-04 16:11 [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge Jiri Slaby
@ 2009-11-04 16:36 ` Alan Cox
2009-11-17 3:17 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2009-11-04 16:36 UTC (permalink / raw)
Cc: jgarzik, linux-ide, linux-kernel, Jiri Slaby
On Wed, 4 Nov 2009 17:11:03 +0100
Jiri Slaby <jirislaby@gmail.com> wrote:
> In via_init_one, when via_isa_bridges iterator reaches
> PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is
> found but rev doesn't match, pci_dev_put(isa) is called twice.
>
> Do pci_dev_put only once.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Jeff Garzik <jgarzik@pobox.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Definitely a far saner way to do it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge
2009-11-04 16:11 [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge Jiri Slaby
2009-11-04 16:36 ` Alan Cox
@ 2009-11-17 3:17 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2009-11-17 3:17 UTC (permalink / raw)
To: Jiri Slaby; +Cc: linux-ide, linux-kernel
On 11/04/2009 11:11 AM, Jiri Slaby wrote:
> In via_init_one, when via_isa_bridges iterator reaches
> PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is
> found but rev doesn't match, pci_dev_put(isa) is called twice.
>
> Do pci_dev_put only once.
>
> Signed-off-by: Jiri Slaby<jirislaby@gmail.com>
> Cc: Jeff Garzik<jgarzik@pobox.com>
> ---
> drivers/ata/pata_via.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-17 3:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 16:11 [PATCH -2nd repost 1/1] ATA: pata_via, fix double put on isa bridge Jiri Slaby
2009-11-04 16:36 ` Alan Cox
2009-11-17 3:17 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).