diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2009-11-04 11:11:03 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-12-03 02:46:34 -0500 |
commit | 7095e3eb49869051594b33f6110edd65aff6be50 (patch) | |
tree | 026df9eb33d60c3a7311cee10d668d47f2627220 | |
parent | ba3a221ce2ec0b636a15e12c23c97af68b9b1114 (diff) |
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>
-rw-r--r-- | 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 88984b803d6d..520d5a31f8a2 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) | |||
526 | .port_ops = &via_port_ops | 526 | .port_ops = &via_port_ops |
527 | }; | 527 | }; |
528 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 528 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
529 | struct pci_dev *isa = NULL; | 529 | struct pci_dev *isa; |
530 | const struct via_isa_bridge *config; | 530 | const struct via_isa_bridge *config; |
531 | static int printed_version; | 531 | static int printed_version; |
532 | u8 enable; | 532 | u8 enable; |
@@ -551,15 +551,13 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
551 | if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + | 551 | if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + |
552 | !!(config->flags & VIA_BAD_ID), | 552 | !!(config->flags & VIA_BAD_ID), |
553 | config->id, NULL))) { | 553 | config->id, NULL))) { |
554 | u8 rev = isa->revision; | ||
555 | pci_dev_put(isa); | ||
554 | 556 | ||
555 | if (isa->revision >= config->rev_min && | 557 | if (rev >= config->rev_min && rev <= config->rev_max) |
556 | isa->revision <= config->rev_max) | ||
557 | break; | 558 | break; |
558 | pci_dev_put(isa); | ||
559 | } | 559 | } |
560 | 560 | ||
561 | pci_dev_put(isa); | ||
562 | |||
563 | if (!(config->flags & VIA_NO_ENABLES)) { | 561 | if (!(config->flags & VIA_NO_ENABLES)) { |
564 | /* 0x40 low bits indicate enabled channels */ | 562 | /* 0x40 low bits indicate enabled channels */ |
565 | pci_read_config_byte(pdev, 0x40 , &enable); | 563 | pci_read_config_byte(pdev, 0x40 , &enable); |