aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r--drivers/scsi/ahci.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 8420204c2eaa..4612312c0c2d 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -307,21 +307,22 @@ static int ahci_port_start(struct ata_port *ap)
307 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 307 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
308 void *mem; 308 void *mem;
309 dma_addr_t mem_dma; 309 dma_addr_t mem_dma;
310 int rc;
310 311
311 pp = kmalloc(sizeof(*pp), GFP_KERNEL); 312 pp = kmalloc(sizeof(*pp), GFP_KERNEL);
312 if (!pp) 313 if (!pp)
313 return -ENOMEM; 314 return -ENOMEM;
314 memset(pp, 0, sizeof(*pp)); 315 memset(pp, 0, sizeof(*pp));
315 316
316 ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ, &ap->pad_dma, GFP_KERNEL); 317 rc = ata_pad_alloc(ap, dev);
317 if (!ap->pad) { 318 if (rc) {
318 kfree(pp); 319 kfree(pp);
319 return -ENOMEM; 320 return rc;
320 } 321 }
321 322
322 mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); 323 mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL);
323 if (!mem) { 324 if (!mem) {
324 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); 325 ata_pad_free(ap, dev);
325 kfree(pp); 326 kfree(pp);
326 return -ENOMEM; 327 return -ENOMEM;
327 } 328 }
@@ -397,7 +398,7 @@ static void ahci_port_stop(struct ata_port *ap)
397 ap->private_data = NULL; 398 ap->private_data = NULL;
398 dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, 399 dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ,
399 pp->cmd_slot, pp->cmd_slot_dma); 400 pp->cmd_slot, pp->cmd_slot_dma);
400 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); 401 ata_pad_free(ap, dev);
401 kfree(pp); 402 kfree(pp);
402} 403}
403 404