pata_via: fix double put on isa bridge

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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
Jiri Slaby 2009-11-04 17:11:03 +01:00 committed by Jeff Garzik
parent ba3a221ce2
commit 7095e3eb49
1 changed files with 5 additions and 7 deletions

View File

@ -526,7 +526,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops .port_ops = &via_port_ops
}; };
const struct ata_port_info *ppi[] = { NULL, NULL }; const struct ata_port_info *ppi[] = { NULL, NULL };
struct pci_dev *isa = NULL; struct pci_dev *isa;
const struct via_isa_bridge *config; const struct via_isa_bridge *config;
static int printed_version; static int printed_version;
u8 enable; u8 enable;
@ -551,14 +551,12 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + if ((isa = pci_get_device(PCI_VENDOR_ID_VIA +
!!(config->flags & VIA_BAD_ID), !!(config->flags & VIA_BAD_ID),
config->id, NULL))) { config->id, NULL))) {
u8 rev = isa->revision;
if (isa->revision >= config->rev_min &&
isa->revision <= config->rev_max)
break;
pci_dev_put(isa); pci_dev_put(isa);
}
pci_dev_put(isa); if (rev >= config->rev_min && rev <= config->rev_max)
break;
}
if (!(config->flags & VIA_NO_ENABLES)) { if (!(config->flags & VIA_NO_ENABLES)) {
/* 0x40 low bits indicate enabled channels */ /* 0x40 low bits indicate enabled channels */