From ce0eb50de83e6ad7aeb0d703d8740a94ca6354c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Romieu?= Date: Thu, 30 Sep 2004 15:53:02 -0400 Subject: [PATCH] [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: Francois Romieu --- drivers/scsi/sata_nv.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index cb46e2f993682..259f678d3a6bf 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c @@ -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 @@ err_out_free_host: 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; } -- 2.53.0