Commit ffb9c6fc authored by François Romieu's avatar François Romieu Committed by Jeff Garzik

[PATCH] sata_nv: wrong failure path and leak

- wrong branching: the driver does not want to iounmap() an address that it
  has just failed to set;
- return a sensible error status code instead of a success code;
- leak plugged: host was never freed if a late error heppened.
Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
parent 6f3dd2e8
......@@ -354,8 +354,10 @@ 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_iounmap;
if (probe_ent->mmio_base == NULL) {
rc = -EIO;
goto err_out_free_host;
}
base = (unsigned long)probe_ent->mmio_base;
......@@ -388,7 +390,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_iounmap:
if (host->host_desc->host_flags & NV_HOST_FLAGS_SCR_MMIO)
iounmap(probe_ent->mmio_base);
err_out_free_host:
kfree(host);
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