提交 79bae27f 编写于 作者: T Thomas Abraham 提交者: Linus Walleij

pinctrl: exynos5440: fix issues reported by prevent tool

This patch fixes issues reported by prevent tool.
Signed-off-by: NThomas Abraham <thomas.ab@samsung.com>
Signed-off-by: NKukjin Kim <kgene.kim@samsung.com>
[Drop hunk already in-tree from a patch by Wei Yongjun]
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 6f924b0b
...@@ -220,7 +220,7 @@ static int exynos5440_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -220,7 +220,7 @@ static int exynos5440_dt_node_to_map(struct pinctrl_dev *pctldev,
dev_err(dev, "failed to alloc memory for group name\n"); dev_err(dev, "failed to alloc memory for group name\n");
goto free_map; goto free_map;
} }
sprintf(gname, "%s%s", np->name, GROUP_SUFFIX); snprintf(gname, strlen(np->name) + 4, "%s%s", np->name, GROUP_SUFFIX);
/* /*
* don't have config options? then skip over to creating function * don't have config options? then skip over to creating function
...@@ -259,7 +259,8 @@ static int exynos5440_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -259,7 +259,8 @@ static int exynos5440_dt_node_to_map(struct pinctrl_dev *pctldev,
dev_err(dev, "failed to alloc memory for func name\n"); dev_err(dev, "failed to alloc memory for func name\n");
goto free_cfg; goto free_cfg;
} }
sprintf(fname, "%s%s", np->name, FUNCTION_SUFFIX); snprintf(fname, strlen(np->name) + 4, "%s%s", np->name,
FUNCTION_SUFFIX);
map[*nmaps].data.mux.group = gname; map[*nmaps].data.mux.group = gname;
map[*nmaps].data.mux.function = fname; map[*nmaps].data.mux.function = fname;
...@@ -713,7 +714,8 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev, ...@@ -713,7 +714,8 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
dev_err(dev, "failed to alloc memory for group name\n"); dev_err(dev, "failed to alloc memory for group name\n");
return -ENOMEM; return -ENOMEM;
} }
sprintf(gname, "%s%s", cfg_np->name, GROUP_SUFFIX); snprintf(gname, strlen(cfg_np->name) + 4, "%s%s", cfg_np->name,
GROUP_SUFFIX);
grp->name = gname; grp->name = gname;
grp->pins = pin_list; grp->pins = pin_list;
...@@ -733,7 +735,8 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev, ...@@ -733,7 +735,8 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
dev_err(dev, "failed to alloc memory for func name\n"); dev_err(dev, "failed to alloc memory for func name\n");
return -ENOMEM; return -ENOMEM;
} }
sprintf(fname, "%s%s", cfg_np->name, FUNCTION_SUFFIX); snprintf(fname, strlen(cfg_np->name) + 4, "%s%s", cfg_np->name,
FUNCTION_SUFFIX);
func->name = fname; func->name = fname;
func->groups = devm_kzalloc(dev, sizeof(char *), GFP_KERNEL); func->groups = devm_kzalloc(dev, sizeof(char *), GFP_KERNEL);
...@@ -806,7 +809,7 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev, ...@@ -806,7 +809,7 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev,
/* for each pin, set the name of the pin */ /* for each pin, set the name of the pin */
for (pin = 0; pin < ctrldesc->npins; pin++) { for (pin = 0; pin < ctrldesc->npins; pin++) {
sprintf(pin_names, "gpio%02d", pin); snprintf(pin_names, 6, "gpio%02d", pin);
pdesc = pindesc + pin; pdesc = pindesc + pin;
pdesc->name = pin_names; pdesc->name = pin_names;
pin_names += PIN_NAME_LENGTH; pin_names += PIN_NAME_LENGTH;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册