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>
This commit is contained in:
committed by
Vinod Koul
parent
77101ce578
commit
945b5af3ce
@@ -278,7 +278,7 @@ static int dmatest_func(void *data)
|
|||||||
dma_cookie_t cookie;
|
dma_cookie_t cookie;
|
||||||
enum dma_status status;
|
enum dma_status status;
|
||||||
enum dma_ctrl_flags flags;
|
enum dma_ctrl_flags flags;
|
||||||
u8 pq_coefs[pq_sources + 1];
|
u8 *pq_coefs = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
int src_cnt;
|
int src_cnt;
|
||||||
int dst_cnt;
|
int dst_cnt;
|
||||||
@@ -302,10 +302,15 @@ static int dmatest_func(void *data)
|
|||||||
/* force odd to ensure dst = src */
|
/* force odd to ensure dst = src */
|
||||||
src_cnt = min_odd(pq_sources | 1, dma_maxpq(dev, 0));
|
src_cnt = min_odd(pq_sources | 1, dma_maxpq(dev, 0));
|
||||||
dst_cnt = 2;
|
dst_cnt = 2;
|
||||||
|
|
||||||
|
pq_coefs = kmalloc(pq_sources+1, GFP_KERNEL);
|
||||||
|
if (!pq_coefs)
|
||||||
|
goto err_thread_type;
|
||||||
|
|
||||||
for (i = 0; i < src_cnt; i++)
|
for (i = 0; i < src_cnt; i++)
|
||||||
pq_coefs[i] = 1;
|
pq_coefs[i] = 1;
|
||||||
} else
|
} else
|
||||||
goto err_srcs;
|
goto err_thread_type;
|
||||||
|
|
||||||
thread->srcs = kcalloc(src_cnt+1, sizeof(u8 *), GFP_KERNEL);
|
thread->srcs = kcalloc(src_cnt+1, sizeof(u8 *), GFP_KERNEL);
|
||||||
if (!thread->srcs)
|
if (!thread->srcs)
|
||||||
@@ -533,6 +538,8 @@ err_dsts:
|
|||||||
err_srcbuf:
|
err_srcbuf:
|
||||||
kfree(thread->srcs);
|
kfree(thread->srcs);
|
||||||
err_srcs:
|
err_srcs:
|
||||||
|
kfree(pq_coefs);
|
||||||
|
err_thread_type:
|
||||||
pr_notice("%s: terminating after %u tests, %u failures (status %d)\n",
|
pr_notice("%s: terminating after %u tests, %u failures (status %d)\n",
|
||||||
thread_name, total_tests, failed_tests, ret);
|
thread_name, total_tests, failed_tests, ret);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user