Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf80ecf7 authored by Markus Elfring's avatar Markus Elfring Committed by Vinod Koul
Browse files

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 29b4817d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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,
	page_list = kmalloc_array(MAX_LCLA_ALLOC_ATTEMPTS,
				  sizeof(*page_list),
				  GFP_KERNEL);

	if (!page_list) {
		ret = -ENOMEM;
		goto failure;