Commit 9834f813 authored by Russell King's avatar Russell King

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: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 0ef64986
...@@ -325,17 +325,6 @@ static int __init omap1_system_dma_init(void) ...@@ -325,17 +325,6 @@ static int __init omap1_system_dma_init(void)
d->dev_caps |= CLEAR_CSR_ON_READ; d->dev_caps |= CLEAR_CSR_ON_READ;
d->dev_caps |= IS_WORD_16; d->dev_caps |= IS_WORD_16;
d->chan = kzalloc(sizeof(struct omap_dma_lch) *
(d->lch_count), GFP_KERNEL);
if (!d->chan) {
dev_err(&pdev->dev,
"%s: Memory allocation failed for d->chan!\n",
__func__);
ret = -ENOMEM;
goto exit_release_d;
}
if (cpu_is_omap15xx()) if (cpu_is_omap15xx())
d->chan_count = 9; d->chan_count = 9;
else if (cpu_is_omap16xx() || cpu_is_omap7xx()) { else if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
...@@ -359,14 +348,14 @@ static int __init omap1_system_dma_init(void) ...@@ -359,14 +348,14 @@ static int __init omap1_system_dma_init(void)
if (ret) { if (ret) {
dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n", dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n",
__func__, pdev->name, pdev->id); __func__, pdev->name, pdev->id);
goto exit_release_chan; goto exit_release_d;
} }
ret = platform_device_add(pdev); ret = platform_device_add(pdev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n", dev_err(&pdev->dev, "%s: Unable to add resources for %s%d\n",
__func__, pdev->name, pdev->id); __func__, pdev->name, pdev->id);
goto exit_release_chan; goto exit_release_d;
} }
dma_pdev = platform_device_register_full(&omap_dma_dev_info); dma_pdev = platform_device_register_full(&omap_dma_dev_info);
...@@ -379,8 +368,6 @@ static int __init omap1_system_dma_init(void) ...@@ -379,8 +368,6 @@ static int __init omap1_system_dma_init(void)
exit_release_pdev: exit_release_pdev:
platform_device_del(pdev); platform_device_del(pdev);
exit_release_chan:
kfree(d->chan);
exit_release_d: exit_release_d:
kfree(d); kfree(d);
exit_release_p: exit_release_p:
......
...@@ -251,13 +251,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) ...@@ -251,13 +251,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
} }
d = oh->dev_attr; d = oh->dev_attr;
d->chan = kzalloc(sizeof(struct omap_dma_lch) *
(d->lch_count), GFP_KERNEL);
if (!d->chan) {
dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
return -ENOMEM;
}
if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP)) if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
d->dev_caps |= HS_CHANNELS_RESERVED; d->dev_caps |= HS_CHANNELS_RESERVED;
......
...@@ -2030,9 +2030,16 @@ static int omap_system_dma_probe(struct platform_device *pdev) ...@@ -2030,9 +2030,16 @@ static int omap_system_dma_probe(struct platform_device *pdev)
dma_lch_count = d->lch_count; dma_lch_count = d->lch_count;
dma_chan_count = dma_lch_count; dma_chan_count = dma_lch_count;
dma_chan = d->chan;
enable_1510_mode = d->dev_caps & ENABLE_1510_MODE; enable_1510_mode = d->dev_caps & ENABLE_1510_MODE;
dma_chan = devm_kcalloc(&pdev->dev, dma_lch_count,
sizeof(struct omap_dma_lch), GFP_KERNEL);
if (!dma_chan) {
dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
return -ENOMEM;
}
if (dma_omap2plus()) { if (dma_omap2plus()) {
dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
dma_lch_count, GFP_KERNEL); dma_lch_count, GFP_KERNEL);
...@@ -2117,7 +2124,6 @@ static int omap_system_dma_probe(struct platform_device *pdev) ...@@ -2117,7 +2124,6 @@ static int omap_system_dma_probe(struct platform_device *pdev)
} }
exit_dma_lch_fail: exit_dma_lch_fail:
kfree(dma_chan);
return ret; return ret;
} }
...@@ -2137,7 +2143,6 @@ static int omap_system_dma_remove(struct platform_device *pdev) ...@@ -2137,7 +2143,6 @@ static int omap_system_dma_remove(struct platform_device *pdev)
free_irq(dma_irq, (void *)(irq_rel + 1)); free_irq(dma_irq, (void *)(irq_rel + 1));
} }
} }
kfree(dma_chan);
return 0; return 0;
} }
......
...@@ -268,7 +268,6 @@ struct omap_dma_dev_attr { ...@@ -268,7 +268,6 @@ struct omap_dma_dev_attr {
u32 dev_caps; u32 dev_caps;
u16 lch_count; u16 lch_count;
u16 chan_count; u16 chan_count;
struct omap_dma_lch *chan;
}; };
enum { enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment