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

Commit 6b72de4d authored by Markus Elfring's avatar Markus Elfring Committed by Tony Lindgren
Browse files

ARM: OMAP2+: Use kcalloc() in sr_set_nvalues()



* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data structure 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>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 1dfb5b59
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -44,9 +44,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
	while (volt_data[count].volt_nominal)
		count++;

	nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count,
			GFP_KERNEL);

	nvalue_table = kcalloc(count, sizeof(*nvalue_table), GFP_KERNEL);
	if (!nvalue_table) {
		pr_err("OMAP: SmartReflex: cannot allocate memory for n-value table\n");
		return;