aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dmatest.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-12-03 09:49:33 -0500
committerVinod Koul <vkoul@kernel.org>2018-12-05 03:07:46 -0500
commit3f3c75541ffe082194e48ea9aa5edf2341f77753 (patch)
tree9d93e0dc74337aba036d43b270bbbaf4da7e420e /drivers/dma/dmatest.c
parent787d3083caf899b8c3abf5a0c7a04e79d77f2c32 (diff)
dmaengine: dmatest: fix a small memory leak in dmatest_func()
We recently moved the test size tests around but it means we need to adjust the error handling as well or we leak the "pq_coefs" memory. I updated the label name to reflect that we're freeing coefs. Fixes: 787d3083caf8 ("dmaengine: dmatest: move size checks earlier in function") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/dmatest.c')
-rw-r--r--drivers/dma/dmatest.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index e71aa1e3451c..28deaa084257 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -511,18 +511,18 @@ static int dmatest_func(void *data)
511 if ((src_cnt + dst_cnt) >= 255) { 511 if ((src_cnt + dst_cnt) >= 255) {
512 pr_err("too many buffers (%d of 255 supported)\n", 512 pr_err("too many buffers (%d of 255 supported)\n",
513 src_cnt + dst_cnt); 513 src_cnt + dst_cnt);
514 goto err_thread_type; 514 goto err_free_coefs;
515 } 515 }
516 516
517 if (1 << align > params->buf_size) { 517 if (1 << align > params->buf_size) {
518 pr_err("%u-byte buffer too small for %d-byte alignment\n", 518 pr_err("%u-byte buffer too small for %d-byte alignment\n",
519 params->buf_size, 1 << align); 519 params->buf_size, 1 << align);
520 goto err_thread_type; 520 goto err_free_coefs;
521 } 521 }
522 522
523 thread->srcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL); 523 thread->srcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL);
524 if (!thread->srcs) 524 if (!thread->srcs)
525 goto err_srcs; 525 goto err_free_coefs;
526 526
527 thread->usrcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL); 527 thread->usrcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL);
528 if (!thread->usrcs) 528 if (!thread->usrcs)
@@ -800,7 +800,7 @@ err_srcbuf:
800 kfree(thread->usrcs); 800 kfree(thread->usrcs);
801err_usrcs: 801err_usrcs:
802 kfree(thread->srcs); 802 kfree(thread->srcs);
803err_srcs: 803err_free_coefs:
804 kfree(pq_coefs); 804 kfree(pq_coefs);
805err_thread_type: 805err_thread_type:
806 pr_info("%s: summary %u tests, %u failures %llu iops %llu KB/s (%d)\n", 806 pr_info("%s: summary %u tests, %u failures %llu iops %llu KB/s (%d)\n",