Commit 1be0593f authored by Markus Elfring's avatar Markus Elfring Committed by Sebastian Reichel

HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "devm_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 avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent 2ea659a9
...@@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev) ...@@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev)
return -EINVAL; return -EINVAL;
} }
modem->gpios = devm_kzalloc(dev, gpio_count * modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios),
sizeof(struct nokia_modem_gpio), GFP_KERNEL); GFP_KERNEL);
if (!modem->gpios) { if (!modem->gpios) {
dev_err(dev, "Could not allocate memory for gpios\n"); dev_err(dev, "Could not allocate memory for gpios\n");
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment