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: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
This commit is contained in:
Markus Elfring 2017-04-25 09:49:22 +02:00 коммит произвёл Sebastian Reichel
Родитель 2ea659a9ef
Коммит 1be0593f05
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev)
return -EINVAL;
}
modem->gpios = devm_kzalloc(dev, gpio_count *
sizeof(struct nokia_modem_gpio), GFP_KERNEL);
modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios),
GFP_KERNEL);
if (!modem->gpios) {
dev_err(dev, "Could not allocate memory for gpios\n");
return -ENOMEM;