Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1623912
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] regulator: s2mps11: Use devm_kmalloc_array() in s2mps11_pmic_probe() |
| Date | 2017-04-14 23:10 +0200 |
| Message-ID | <twgDD-69I-1@gated-at.bofh.it> (permalink) |
| References | <twgDD-69I-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 14 Apr 2017 22:40:19 +0200 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_kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/regulator/s2mps11.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index b4e588cce03d..b397a2e0bcd1 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1139,9 +1139,11 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) return -EINVAL; } - s2mps11->ext_control_gpio = devm_kmalloc(&pdev->dev, - sizeof(*s2mps11->ext_control_gpio) * rdev_num, - GFP_KERNEL); + s2mps11->ext_control_gpio + = devm_kmalloc_array(&pdev->dev, + rdev_num, + sizeof(*s2mps11->ext_control_gpio), + GFP_KERNEL); if (!s2mps11->ext_control_gpio) return -ENOMEM; /* -- 2.12.2
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 2/2] regulator: s2mps11: Use devm_kmalloc_array() in s2mps11_pmic_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-14 23:10 +0200
csiph-web