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) ...@@ -311,7 +311,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
static int printed_version = 0; static int printed_version = 0;
struct nv_host *host; struct nv_host *host;
struct ata_port_info *ppi; struct ata_port_info *ppi;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent;
int rc; int rc;
if (!printed_version++) if (!printed_version++)
...@@ -319,11 +319,11 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -319,11 +319,11 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) if (rc)
return rc; goto err_out;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc)
goto err_out; goto err_out_disable;
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -332,18 +332,16 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -332,18 +332,16 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto err_out_regions; goto err_out_regions;
rc = -ENOMEM;
ppi = &nv_port_info; ppi = &nv_port_info;
probe_ent = ata_pci_init_native_mode(pdev, &ppi); probe_ent = ata_pci_init_native_mode(pdev, &ppi);
if (!probe_ent) { if (!probe_ent)
rc = -ENOMEM;
goto err_out_regions; goto err_out_regions;
}
host = kmalloc(sizeof(struct nv_host), GFP_KERNEL); host = kmalloc(sizeof(struct nv_host), GFP_KERNEL);
if (!host) { if (!host)
rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
}
host->host_desc = &nv_device_tbl[ent->driver_data]; 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) ...@@ -394,12 +392,11 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
kfree(host); kfree(host);
err_out_free_ent: err_out_free_ent:
kfree(probe_ent); kfree(probe_ent);
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out_disable:
err_out:
pci_disable_device(pdev); pci_disable_device(pdev);
err_out:
return rc; 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