Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1736367
| From | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] PM / OPP: Use snprintf to avoid kasprintf and kfree |
| Date | 2017-09-21 07:50 +0200 |
| Message-ID | <us2x4-55T-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Use snprintf to avoid unnecessary initializations, avoid calling kfree.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
changes in v2:
Remove kasprintf instead of error checking.
drivers/base/power/opp/debugfs.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
index 81cf120..a2fa785 100644
--- a/drivers/base/power/opp/debugfs.c
+++ b/drivers/base/power/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;
--
1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2] PM / OPP: Use snprintf to avoid kasprintf and kfree Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-21 07:50 +0200 Re: [PATCH v2] PM / OPP: Use snprintf to avoid kasprintf and kfree Viresh Kumar <viresh.kumar@linaro.org> - 2017-09-21 19:50 +0200 Re: [PATCH v2] PM / OPP: Use snprintf to avoid kasprintf and kfree Stephen Boyd <sboyd@codeaurora.org> - 2017-09-22 09:20 +0200
csiph-web