]> git.neil.brown.name Git - history.git/commitdiff
[libata sata_nv] fix leak on error
authorAndrew Chew <achew@nvidia.com>
Wed, 18 Aug 2004 16:39:03 +0000 (12:39 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Wed, 18 Aug 2004 16:39:03 +0000 (12:39 -0400)
Spotted by Francois Romieu.

drivers/scsi/sata_nv.c

index 1092a4b97d315f42f9c3dc226af0401d8fd6d87f..867b77eb500fcc98f2fa1c7826e02b581568a4a8 100644 (file)
@@ -372,7 +372,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                probe_ent->mmio_base = ioremap(pci_resource_start(pdev, 5),
                                pci_resource_len(pdev, 5));
                if (probe_ent->mmio_base == NULL)
-                       goto err_out_free_ent;
+                       goto err_out_iounmap;
 
                base = (unsigned long)probe_ent->mmio_base;
 
@@ -396,12 +396,16 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
        rc = ata_device_add(probe_ent);
        if (rc != NV_PORTS)
-               goto err_out_free_ent;
+               goto err_out_iounmap;
 
        kfree(probe_ent);
 
        return 0;
 
+err_out_iounmap:
+       if (host->host_desc->host_flags & NV_HOST_FLAGS_SCR_MMIO)
+               iounmap(probe_ent->mmio_base);
+
 err_out_free_ent:
        kfree(probe_ent);