summaryrefslogtreecommitdiffstats
path: root/drivers/opp
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-09-21 01:45:36 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-10-10 19:49:17 -0400
commitd741029a2390406d4d94279ae5b346831a9e61e6 (patch)
tree83ff522f4ee8e0ce726f33e9c7b8ed7574c91555 /drivers/opp
parent7813dd6fc75fb375d4caf002e7f80a826fc3153a (diff)
PM / OPP: Use snprintf() to avoid kasprintf() and kfree()
Use snprintf() to avoid unnecessary initializations, avoid calling kfree(). Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/opp')
-rw-r--r--drivers/opp/debugfs.c7
1 files changed, 3 insertions, 4 deletions
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,
41{ 41{
42 struct dentry *d; 42 struct dentry *d;
43 int i; 43 int i;
44 char *name;
45 44
46 for (i = 0; i < opp_table->regulator_count; i++) { 45 for (i = 0; i < opp_table->regulator_count; i++) {
47 name = kasprintf(GFP_KERNEL, "supply-%d", i); 46 char name[15];
47
48 snprintf(name, sizeof(name), "supply-%d", i);
48 49
49 /* Create per-opp directory */ 50 /* Create per-opp directory */
50 d = debugfs_create_dir(name, pdentry); 51 d = debugfs_create_dir(name, pdentry);
51 52
52 kfree(name);
53
54 if (!d) 53 if (!d)
55 return false; 54 return false;
56 55