diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-04-25 03:49:22 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2017-06-08 07:21:43 -0400 |
commit | 1be0593f05e25d56a8f65586ea6d9afa601743bc (patch) | |
tree | d47aa5ac517415aaa6b19537e21a58c71fbdeaf2 /drivers/hsi | |
parent | 2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff) |
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>
Diffstat (limited to 'drivers/hsi')
-rw-r--r-- | drivers/hsi/clients/nokia-modem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c index c000780d931f..f6c97a0e1fcd 100644 --- a/drivers/hsi/clients/nokia-modem.c +++ b/drivers/hsi/clients/nokia-modem.c | |||
@@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev) | |||
102 | return -EINVAL; | 102 | return -EINVAL; |
103 | } | 103 | } |
104 | 104 | ||
105 | modem->gpios = devm_kzalloc(dev, gpio_count * | 105 | modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios), |
106 | sizeof(struct nokia_modem_gpio), GFP_KERNEL); | 106 | GFP_KERNEL); |
107 | if (!modem->gpios) { | 107 | if (!modem->gpios) { |
108 | dev_err(dev, "Could not allocate memory for gpios\n"); | 108 | dev_err(dev, "Could not allocate memory for gpios\n"); |
109 | return -ENOMEM; | 109 | return -ENOMEM; |