]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
pata_via: fix double put on isa bridge
authorJiri Slaby <jirislaby@gmail.com>
Wed, 4 Nov 2009 16:11:03 +0000 (17:11 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 3 Dec 2009 07:46:34 +0000 (02:46 -0500)
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>
drivers/ata/pata_via.c

index 88984b803d6dab2c2137c8203ad1669f8719ceff..520d5a31f8a2a345678c065adbf8028ed2964a1f 100644 (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
        };
        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);