Commit d55b7fdd authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Walleij

pinctrl: xway: Use devm_kasprintf() instead of fixed buffer formatting

Improve readability and maintainability by replacing a hardcoded string
allocation and formatting by the use of the devm_kasprintf() helper.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20190731132917.17607-4-geert+renesas@glider.beSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 811604d0
...@@ -1731,13 +1731,11 @@ static int pinmux_xway_probe(struct platform_device *pdev) ...@@ -1731,13 +1731,11 @@ static int pinmux_xway_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < xway_chip.ngpio; i++) { for (i = 0; i < xway_chip.ngpio; i++) {
/* strlen("ioXY") + 1 = 5 */ char *name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "io%d", i);
char *name = devm_kzalloc(&pdev->dev, 5, GFP_KERNEL);
if (!name) if (!name)
return -ENOMEM; return -ENOMEM;
snprintf(name, 5, "io%d", i);
xway_info.pads[i].number = GPIO0 + i; xway_info.pads[i].number = GPIO0 + i;
xway_info.pads[i].name = name; xway_info.pads[i].name = name;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment