diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-09-16 17:56:07 +0200 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2016-09-26 19:36:16 +0200 |
commit | cf80ecf7a277e7908264f822c721f93403cf518f (patch) | |
tree | 3ebfc056b4a29efbb9dac70035fb715b52ae0adb /drivers/dma | |
parent | Linux 4.8-rc1 (diff) | |
download | linux-cf80ecf7a277e7908264f822c721f93403cf518f.tar.xz linux-cf80ecf7a277e7908264f822c721f93403cf518f.zip |
ste_dma40: Use kmalloc_array() in d40_lcla_allocate()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ste_dma40.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 8b18e44a02d5..156199d168bf 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3411,9 +3411,9 @@ static int __init d40_lcla_allocate(struct d40_base *base) * To full fill this hardware requirement without wasting 256 kb * we allocate pages until we get an aligned one. */ - page_list = kmalloc(sizeof(unsigned long) * MAX_LCLA_ALLOC_ATTEMPTS, - GFP_KERNEL); - + page_list = kmalloc_array(MAX_LCLA_ALLOC_ATTEMPTS, + sizeof(*page_list), + GFP_KERNEL); if (!page_list) { ret = -ENOMEM; goto failure; |