diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-03-04 04:09:26 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-04-15 00:21:16 -0400 |
commit | 945b5af3cedcdfed6d2d940e53cd19933bb57386 (patch) | |
tree | 4107086f55816e78e4bbd08bb9abc94df137cee4 /drivers/dma | |
parent | 77101ce578bb365e44c2944d6c338c68206e6e10 (diff) |
dmatest: allocate memory for pq_coefs from heap
This will help in future to hide a global variable usage.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/dmatest.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index e6b4cfa1eb7f..e3955be2e3a4 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -278,7 +278,7 @@ static int dmatest_func(void *data) | |||
278 | dma_cookie_t cookie; | 278 | dma_cookie_t cookie; |
279 | enum dma_status status; | 279 | enum dma_status status; |
280 | enum dma_ctrl_flags flags; | 280 | enum dma_ctrl_flags flags; |
281 | u8 pq_coefs[pq_sources + 1]; | 281 | u8 *pq_coefs = NULL; |
282 | int ret; | 282 | int ret; |
283 | int src_cnt; | 283 | int src_cnt; |
284 | int dst_cnt; | 284 | int dst_cnt; |
@@ -302,10 +302,15 @@ static int dmatest_func(void *data) | |||
302 | /* force odd to ensure dst = src */ | 302 | /* force odd to ensure dst = src */ |
303 | src_cnt = min_odd(pq_sources | 1, dma_maxpq(dev, 0)); | 303 | src_cnt = min_odd(pq_sources | 1, dma_maxpq(dev, 0)); |
304 | dst_cnt = 2; | 304 | dst_cnt = 2; |
305 | |||
306 | pq_coefs = kmalloc(pq_sources+1, GFP_KERNEL); | ||
307 | if (!pq_coefs) | ||
308 | goto err_thread_type; | ||
309 | |||
305 | for (i = 0; i < src_cnt; i++) | 310 | for (i = 0; i < src_cnt; i++) |
306 | pq_coefs[i] = 1; | 311 | pq_coefs[i] = 1; |
307 | } else | 312 | } else |
308 | goto err_srcs; | 313 | goto err_thread_type; |
309 | 314 | ||
310 | thread->srcs = kcalloc(src_cnt+1, sizeof(u8 *), GFP_KERNEL); | 315 | thread->srcs = kcalloc(src_cnt+1, sizeof(u8 *), GFP_KERNEL); |
311 | if (!thread->srcs) | 316 | if (!thread->srcs) |
@@ -533,6 +538,8 @@ err_dsts: | |||
533 | err_srcbuf: | 538 | err_srcbuf: |
534 | kfree(thread->srcs); | 539 | kfree(thread->srcs); |
535 | err_srcs: | 540 | err_srcs: |
541 | kfree(pq_coefs); | ||
542 | err_thread_type: | ||
536 | pr_notice("%s: terminating after %u tests, %u failures (status %d)\n", | 543 | pr_notice("%s: terminating after %u tests, %u failures (status %d)\n", |
537 | thread_name, total_tests, failed_tests, ret); | 544 | thread_name, total_tests, failed_tests, ret); |
538 | 545 | ||