From: Arvind Yadav Date: Thu, 21 Sep 2017 05:45:36 +0000 (+0530) Subject: PM / OPP: Use snprintf() to avoid kasprintf() and kfree() X-Git-Tag: v4.15-rc1~145^2~4^3~7 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d741029a2390406d4d94279ae5b346831a9e61e6;p=uclinux-h8%2Flinux.git PM / OPP: Use snprintf() to avoid kasprintf() and kfree() Use snprintf() to avoid unnecessary initializations, avoid calling kfree(). Signed-off-by: Arvind Yadav Acked-by: Viresh Kumar Reviewed-by: Stephen Boyd Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c index 81cf120fcf43..9318848f3c67 100644 --- a/drivers/opp/debugfs.c +++ b/drivers/opp/debugfs.c @@ -41,16 +41,15 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp, { struct dentry *d; int i; - char *name; for (i = 0; i < opp_table->regulator_count; i++) { - name = kasprintf(GFP_KERNEL, "supply-%d", i); + char name[15]; + + snprintf(name, sizeof(name), "supply-%d", i); /* Create per-opp directory */ d = debugfs_create_dir(name, pdentry); - kfree(name); - if (!d) return false;