Commit d741029a authored by Arvind Yadav's avatar Arvind Yadav Committed by Rafael J. Wysocki

PM / OPP: Use snprintf() to avoid kasprintf() and kfree()

Use snprintf() to avoid unnecessary initializations, avoid calling
kfree().
Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7813dd6f
...@@ -41,16 +41,15 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp, ...@@ -41,16 +41,15 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
{ {
struct dentry *d; struct dentry *d;
int i; int i;
char *name;
for (i = 0; i < opp_table->regulator_count; i++) { 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 */ /* Create per-opp directory */
d = debugfs_create_dir(name, pdentry); d = debugfs_create_dir(name, pdentry);
kfree(name);
if (!d) if (!d)
return false; return false;
......
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