Commit b5ac4f2c authored by Andrew Chew's avatar Andrew Chew Committed by Jeff Garzik

[libata sata_nv] fix leak on error

Spotted by Francois Romieu.
parent d0ecdda0
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment