diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-11-08 13:10:42 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-04-03 19:31:46 -0400 |
commit | 9834f81314b2a5b1bb3cd0d8f46e61528b60d580 (patch) | |
tree | 6fb62c450a3a6587b312d2f0542b4fe25af7767d /arch/arm/plat-omap | |
parent | 0ef64986d69602ba8df933c62d0b6d6edfaf0557 (diff) |
ARM: omap: move dma channel allocation into plat-omap code
This really needs to be there, because otherwise the plat-omap code can
kfree() this data structure, and then re-use the pointer later.
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/dma.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index d4d9a5e62152..5f5b975887fc 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
@@ -2030,9 +2030,16 @@ static int omap_system_dma_probe(struct platform_device *pdev) | |||
2030 | 2030 | ||
2031 | dma_lch_count = d->lch_count; | 2031 | dma_lch_count = d->lch_count; |
2032 | dma_chan_count = dma_lch_count; | 2032 | dma_chan_count = dma_lch_count; |
2033 | dma_chan = d->chan; | ||
2034 | enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; | 2033 | enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; |
2035 | 2034 | ||
2035 | dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count, | ||
2036 | sizeof(struct omap_dma_lch), GFP_KERNEL); | ||
2037 | if (!dma_chan) { | ||
2038 | dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__); | ||
2039 | return -ENOMEM; | ||
2040 | } | ||
2041 | |||
2042 | |||
2036 | if (dma_omap2plus()) { | 2043 | if (dma_omap2plus()) { |
2037 | dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * | 2044 | dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * |
2038 | dma_lch_count, GFP_KERNEL); | 2045 | dma_lch_count, GFP_KERNEL); |
@@ -2117,7 +2124,6 @@ exit_dma_irq_fail: | |||
2117 | } | 2124 | } |
2118 | 2125 | ||
2119 | exit_dma_lch_fail: | 2126 | exit_dma_lch_fail: |
2120 | kfree(dma_chan); | ||
2121 | return ret; | 2127 | return ret; |
2122 | } | 2128 | } |
2123 | 2129 | ||
@@ -2137,7 +2143,6 @@ static int omap_system_dma_remove(struct platform_device *pdev) | |||
2137 | free_irq(dma_irq, (void *)(irq_rel + 1)); | 2143 | free_irq(dma_irq, (void *)(irq_rel + 1)); |
2138 | } | 2144 | } |
2139 | } | 2145 | } |
2140 | kfree(dma_chan); | ||
2141 | return 0; | 2146 | return 0; |
2142 | } | 2147 | } |
2143 | 2148 | ||