aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_dwc_460ex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_dwc_460ex.c')
-rw-r--r--drivers/ata/sata_dwc_460ex.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index c7ddef89e7b0..8e8248179d20 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -797,7 +797,7 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq)
797 if (err) { 797 if (err) {
798 dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns" 798 dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns"
799 " %d\n", __func__, err); 799 " %d\n", __func__, err);
800 goto error_out; 800 return err;
801 } 801 }
802 802
803 /* Enabe DMA */ 803 /* Enabe DMA */
@@ -808,11 +808,6 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq)
808 sata_dma_regs); 808 sata_dma_regs);
809 809
810 return 0; 810 return 0;
811
812error_out:
813 dma_dwc_exit(hsdev);
814
815 return err;
816} 811}
817 812
818static int sata_dwc_scr_read(struct ata_link *link, unsigned int scr, u32 *val) 813static int sata_dwc_scr_read(struct ata_link *link, unsigned int scr, u32 *val)
@@ -1662,7 +1657,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1662 char *ver = (char *)&versionr; 1657 char *ver = (char *)&versionr;
1663 u8 *base = NULL; 1658 u8 *base = NULL;
1664 int err = 0; 1659 int err = 0;
1665 int irq, rc; 1660 int irq;
1666 struct ata_host *host; 1661 struct ata_host *host;
1667 struct ata_port_info pi = sata_dwc_port_info[0]; 1662 struct ata_port_info pi = sata_dwc_port_info[0];
1668 const struct ata_port_info *ppi[] = { &pi, NULL }; 1663 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1725,7 +1720,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1725 if (irq == NO_IRQ) { 1720 if (irq == NO_IRQ) {
1726 dev_err(&ofdev->dev, "no SATA DMA irq\n"); 1721 dev_err(&ofdev->dev, "no SATA DMA irq\n");
1727 err = -ENODEV; 1722 err = -ENODEV;
1728 goto error_out; 1723 goto error_iomap;
1729 } 1724 }
1730 1725
1731 /* Get physical SATA DMA register base address */ 1726 /* Get physical SATA DMA register base address */
@@ -1734,14 +1729,16 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1734 dev_err(&ofdev->dev, "ioremap failed for AHBDMA register" 1729 dev_err(&ofdev->dev, "ioremap failed for AHBDMA register"
1735 " address\n"); 1730 " address\n");
1736 err = -ENODEV; 1731 err = -ENODEV;
1737 goto error_out; 1732 goto error_iomap;
1738 } 1733 }
1739 1734
1740 /* Save dev for later use in dev_xxx() routines */ 1735 /* Save dev for later use in dev_xxx() routines */
1741 host_pvt.dwc_dev = &ofdev->dev; 1736 host_pvt.dwc_dev = &ofdev->dev;
1742 1737
1743 /* Initialize AHB DMAC */ 1738 /* Initialize AHB DMAC */
1744 dma_dwc_init(hsdev, irq); 1739 err = dma_dwc_init(hsdev, irq);
1740 if (err)
1741 goto error_dma_iomap;
1745 1742
1746 /* Enable SATA Interrupts */ 1743 /* Enable SATA Interrupts */
1747 sata_dwc_enable_interrupts(hsdev); 1744 sata_dwc_enable_interrupts(hsdev);
@@ -1759,9 +1756,8 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1759 * device discovery process, invoking our port_start() handler & 1756 * device discovery process, invoking our port_start() handler &
1760 * error_handler() to execute a dummy Softreset EH session 1757 * error_handler() to execute a dummy Softreset EH session
1761 */ 1758 */
1762 rc = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); 1759 err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht);
1763 1760 if (err)
1764 if (rc != 0)
1765 dev_err(&ofdev->dev, "failed to activate host"); 1761 dev_err(&ofdev->dev, "failed to activate host");
1766 1762
1767 dev_set_drvdata(&ofdev->dev, host); 1763 dev_set_drvdata(&ofdev->dev, host);
@@ -1770,7 +1766,8 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1770error_out: 1766error_out:
1771 /* Free SATA DMA resources */ 1767 /* Free SATA DMA resources */
1772 dma_dwc_exit(hsdev); 1768 dma_dwc_exit(hsdev);
1773 1769error_dma_iomap:
1770 iounmap((void __iomem *)host_pvt.sata_dma_regs);
1774error_iomap: 1771error_iomap:
1775 iounmap(base); 1772 iounmap(base);
1776error_kmalloc: 1773error_kmalloc:
@@ -1791,6 +1788,7 @@ static int sata_dwc_remove(struct platform_device *ofdev)
1791 /* Free SATA DMA resources */ 1788 /* Free SATA DMA resources */
1792 dma_dwc_exit(hsdev); 1789 dma_dwc_exit(hsdev);
1793 1790
1791 iounmap((void __iomem *)host_pvt.sata_dma_regs);
1794 iounmap(hsdev->reg_base); 1792 iounmap(hsdev->reg_base);
1795 kfree(hsdev); 1793 kfree(hsdev);
1796 kfree(host); 1794 kfree(host);