summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorBenoit Taine <benoit.taine@lip6.fr>2014-05-26 17:21:27 +0200
committerLinus Walleij <linus.walleij@linaro.org>2014-05-27 16:06:08 +0200
commitdb388dfb90368638ad238c27b045b6c9bf1f6c17 (patch)
tree470aad0e48d64129fb0925d021ad1b9068460dd8 /drivers/pinctrl
parent49cfabc20ac9ab6117093460a5ac418922e8e9b0 (diff)
pinctrl: pinconf-generic: Use kmemdup instead of kmalloc + memcpy
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine <benoit.taine@lip6.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinconf-generic.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 3d9a999fb69..2457ca961f1 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -228,13 +228,12 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
* Now limit the number of configs to the real number of
* found properties.
*/
- *configs = kzalloc(ncfg * sizeof(unsigned long), GFP_KERNEL);
+ *configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
if (!*configs) {
ret = -ENOMEM;
goto out;
}
- memcpy(*configs, cfg, ncfg * sizeof(unsigned long));
*nconfigs = ncfg;
out: