[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190731132917.17607-3-geert+renesas@glider.be>
Date: Wed, 31 Jul 2019 15:29:16 +0200
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH 2/3] pinctrl: lantiq: Use kasprintf() instead of fixed buffer formatting
Improve readability and maintainability by replacing a hardcoded string
allocation and formatting by the use of the kasprintf() helper.
Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
drivers/pinctrl/pinctrl-falcon.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
index ef133a82e612544a..4a3b8d2677fd498f 100644
--- a/drivers/pinctrl/pinctrl-falcon.c
+++ b/drivers/pinctrl/pinctrl-falcon.c
@@ -96,12 +96,8 @@ static void lantiq_load_pin_desc(struct pinctrl_pin_desc *d, int bank, int len)
int i;
for (i = 0; i < len; i++) {
- /* strlen("ioXYZ") + 1 = 6 */
- char *name = kzalloc(6, GFP_KERNEL);
-
- snprintf(name, 6, "io%d", base + i);
d[i].number = base + i;
- d[i].name = name;
+ d[i].name = kasprintf(GFP_KERNEL, "io%d", base + i);
}
pad_count[bank] = len;
}
--
2.17.1
Powered by blists - more mailing lists