aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_sis.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_sis.c')
-rw-r--r--drivers/ata/sata_sis.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index af6f42578f59..7e51f1c0f7cb 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -126,8 +126,6 @@ static const struct ata_port_operations sis_ops = {
126 .scr_read = sis_scr_read, 126 .scr_read = sis_scr_read,
127 .scr_write = sis_scr_write, 127 .scr_write = sis_scr_write,
128 .port_start = ata_port_start, 128 .port_start = ata_port_start,
129 .port_stop = ata_port_stop,
130 .host_stop = ata_host_stop,
131}; 129};
132 130
133static struct ata_port_info sis_port_info = { 131static struct ata_port_info sis_port_info = {
@@ -260,29 +258,28 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
260 int rc; 258 int rc;
261 u32 genctl, val; 259 u32 genctl, val;
262 struct ata_port_info pi = sis_port_info, *ppi[2] = { &pi, &pi }; 260 struct ata_port_info pi = sis_port_info, *ppi[2] = { &pi, &pi };
263 int pci_dev_busy = 0;
264 u8 pmr; 261 u8 pmr;
265 u8 port2_start = 0x20; 262 u8 port2_start = 0x20;
266 263
267 if (!printed_version++) 264 if (!printed_version++)
268 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 265 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
269 266
270 rc = pci_enable_device(pdev); 267 rc = pcim_enable_device(pdev);
271 if (rc) 268 if (rc)
272 return rc; 269 return rc;
273 270
274 rc = pci_request_regions(pdev, DRV_NAME); 271 rc = pci_request_regions(pdev, DRV_NAME);
275 if (rc) { 272 if (rc) {
276 pci_dev_busy = 1; 273 pcim_pin_device(pdev);
277 goto err_out; 274 return rc;
278 } 275 }
279 276
280 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 277 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
281 if (rc) 278 if (rc)
282 goto err_out_regions; 279 return rc;
283 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK); 280 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
284 if (rc) 281 if (rc)
285 goto err_out_regions; 282 return rc;
286 283
287 /* check and see if the SCRs are in IO space or PCI cfg space */ 284 /* check and see if the SCRs are in IO space or PCI cfg space */
288 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); 285 pci_read_config_dword(pdev, SIS_GENCTL, &genctl);
@@ -351,10 +348,8 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
351 } 348 }
352 349
353 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 350 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
354 if (!probe_ent) { 351 if (!probe_ent)
355 rc = -ENOMEM; 352 return -ENOMEM;
356 goto err_out_regions;
357 }
358 353
359 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) { 354 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) {
360 probe_ent->port[0].scr_addr = 355 probe_ent->port[0].scr_addr =
@@ -366,20 +361,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
366 pci_set_master(pdev); 361 pci_set_master(pdev);
367 pci_intx(pdev, 1); 362 pci_intx(pdev, 1);
368 363
369 /* FIXME: check ata_device_add return value */ 364 if (!ata_device_add(probe_ent))
370 ata_device_add(probe_ent); 365 return -EIO;
371 kfree(probe_ent);
372 366
367 devm_kfree(&pdev->dev, probe_ent);
373 return 0; 368 return 0;
374 369
375err_out_regions:
376 pci_release_regions(pdev);
377
378err_out:
379 if (!pci_dev_busy)
380 pci_disable_device(pdev);
381 return rc;
382
383} 370}
384 371
385static int __init sis_init(void) 372static int __init sis_init(void)