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

[PATCH] sata_nv: housekeeping for goto labels

- each label used in a goto contains a part of the operation that must
  be issued. This way both the no-error and the error paths can be checked
  separately;
- probe_ent does not need to be NULL-initialized.
Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
parent ffb9c6fc
......@@ -311,7 +311,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
static int printed_version = 0;
struct nv_host *host;
struct ata_port_info *ppi;
struct ata_probe_ent *probe_ent = NULL;
struct ata_probe_ent *probe_ent;
int rc;
if (!printed_version++)
......@@ -319,11 +319,11 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
rc = pci_enable_device(pdev);
if (rc)
return rc;
goto err_out;
rc = pci_request_regions(pdev, DRV_NAME);
if (rc)
goto err_out;
goto err_out_disable;
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc)
......@@ -332,18 +332,16 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
goto err_out_regions;
rc = -ENOMEM;
ppi = &nv_port_info;
probe_ent = ata_pci_init_native_mode(pdev, &ppi);
if (!probe_ent) {
rc = -ENOMEM;
if (!probe_ent)
goto err_out_regions;
}
host = kmalloc(sizeof(struct nv_host), GFP_KERNEL);
if (!host) {
rc = -ENOMEM;
if (!host)
goto err_out_free_ent;
}
host->host_desc = &nv_device_tbl[ent->driver_data];
......@@ -394,12 +392,11 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
kfree(host);
err_out_free_ent:
kfree(probe_ent);
err_out_regions:
pci_release_regions(pdev);
err_out:
err_out_disable:
pci_disable_device(pdev);
err_out:
return rc;
}
......
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