From: Viresh Kumar <viresh.kumar@linaro.org>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: vireshk@kernel.org, nm@ti.com, sboyd@codeaurora.org,
rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com,
gregkh@linuxfoundation.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] PM / OPP: Use snprintf to avoid kasprintf and kfree
Date: Thu, 21 Sep 2017 10:48:32 -0700 [thread overview]
Message-ID: <20170921174832.GA17243@ubuntu> (raw)
In-Reply-To: <6cdcf0c59a9a045941188356a2c4973c876c9fc6.1505972576.git.arvind.yadav.cs@gmail.com>
On 21-09-17, 11:15, Arvind Yadav wrote:
> Use snprintf to avoid unnecessary initializations, avoid calling kfree.
>
Suggested-by: Joe Perches <joe@perches.com>
> 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;
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2017-09-21 17:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 5:45 [PATCH v2] PM / OPP: Use snprintf to avoid kasprintf and kfree Arvind Yadav
2017-09-21 17:48 ` Viresh Kumar [this message]
2017-09-22 7:17 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170921174832.GA17243@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=sboyd@codeaurora.org \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).