From: Suman Anna <s-anna@ti.com>
To: Alex Elder <elder@linaro.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
<bjorn.andersson@linaro.org>, <ohad@wizery.com>
Cc: <Markus.Elfring@web.de>, <linux-remoteproc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/7] remoteproc: Use kstrdup_const() rather than kstrup()
Date: Fri, 17 Apr 2020 08:44:02 -0500 [thread overview]
Message-ID: <3f0a602a-64ff-8092-3cca-b63bab8a79f0@ti.com> (raw)
Message-ID: <20200417134402.VsQtD0GsHrmyr_gDvfBIXoO5Mw7EaMLm-7dAx70Atgc@z> (raw)
In-Reply-To: <14b12ca8-823b-8115-bafa-281180e92c70@linaro.org>
On 4/15/20 4:25 PM, Alex Elder wrote:
> On 4/15/20 3:48 PM, Mathieu Poirier wrote:
>> For cases where @firmware is declared "const char *", use function
>> kstrdup_const() to avoid needlessly creating another copy on the
>> heap.
>>
>> Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
>> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> Looks good.
>
> Reviewed-by: Alex Elder <elder@linaro.org>
>
>> ---
>> drivers/remoteproc/remoteproc_core.c | 4 ++--
>> include/linux/remoteproc.h | 2 +-
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
>> index 9899467fa1cf..ebaff496ef81 100644
>> --- a/drivers/remoteproc/remoteproc_core.c
>> +++ b/drivers/remoteproc/remoteproc_core.c
>> @@ -1982,7 +1982,7 @@ static const struct device_type rproc_type = {
>> static int rproc_alloc_firmware(struct rproc *rproc,
>> const char *name, const char *firmware)
>> {
>> - char *p;
>> + const char *p;
>>
>> if (!firmware)
>> /*
>> @@ -1991,7 +1991,7 @@ static int rproc_alloc_firmware(struct rproc *rproc,
>> */
>> p = kasprintf(GFP_KERNEL, "rproc-%s-fw", name);
So, to be consistent for both paths, should we be using
kvasprintf_const() here and kfree_const() in release. The kfree_const()
is needed to account for the kstrdup_const below for sure.
regards
Suman
>> else
>> - p = kstrdup(firmware, GFP_KERNEL);
>> + p = kstrdup_const(firmware, GFP_KERNEL);
>>
>> if (!p)
>> return -ENOMEM;
>> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
>> index 9c07d7958c53..38607107b7cb 100644
>> --- a/include/linux/remoteproc.h
>> +++ b/include/linux/remoteproc.h
>> @@ -489,7 +489,7 @@ struct rproc {
>> struct list_head node;
>> struct iommu_domain *domain;
>> const char *name;
>> - char *firmware;
>> + const char *firmware;
>> void *priv;
>> struct rproc_ops *ops;
>> struct device dev;
>>
>
next prev parent reply other threads:[~2020-04-17 13:44 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 20:48 [PATCH v2 0/7] remoteproc: Refactor function rproc_alloc() Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-15 20:48 ` [PATCH v2 1/7] remoteproc: Fix IDR initialisation in rproc_alloc() Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-17 13:37 ` Suman Anna
2020-04-17 13:37 ` Suman Anna
2020-04-20 5:00 ` Bjorn Andersson
2020-04-20 5:00 ` Bjorn Andersson
2020-04-15 20:48 ` [PATCH v2 2/7] remoteproc: Split firmware name allocation from rproc_alloc() Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-15 21:28 ` Alex Elder
2020-04-15 21:28 ` Alex Elder
2020-04-20 5:09 ` Bjorn Andersson
2020-04-20 5:09 ` Bjorn Andersson
2020-04-20 9:24 ` Arnaud POULIQUEN
2020-04-20 9:24 ` Arnaud POULIQUEN
2020-04-20 21:29 ` Mathieu Poirier
2020-04-20 21:29 ` Mathieu Poirier
2020-04-15 20:48 ` [PATCH v2 3/7] remoteproc: Simplify default name allocation Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-15 21:26 ` Alex Elder
2020-04-15 21:26 ` Alex Elder
2020-04-20 5:10 ` Bjorn Andersson
2020-04-20 5:10 ` Bjorn Andersson
2020-04-15 20:48 ` [PATCH v2 4/7] remoteproc: Use kstrdup_const() rather than kstrup() Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-15 21:25 ` Alex Elder
2020-04-15 21:25 ` Alex Elder
2020-04-17 13:44 ` Suman Anna [this message]
2020-04-17 13:44 ` Suman Anna
2020-04-20 5:21 ` Bjorn Andersson
2020-04-20 5:21 ` Bjorn Andersson
2020-04-17 16:12 ` [v2 4/7] remoteproc: Use kstrdup_const() rather than kstrdup() Markus Elfring
2020-04-17 16:12 ` Markus Elfring
2020-04-15 20:48 ` [PATCH v2 5/7] remoteproc: Restructure firmware name allocation Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-15 21:23 ` Alex Elder
2020-04-15 21:23 ` Alex Elder
2020-04-20 5:17 ` Bjorn Andersson
2020-04-20 5:17 ` Bjorn Andersson
2020-04-16 6:26 ` Markus Elfring
2020-04-16 6:26 ` Markus Elfring
2020-04-17 13:39 ` Suman Anna
2020-04-17 13:39 ` Suman Anna
2020-04-17 15:48 ` [v2 " Markus Elfring
2020-04-17 15:48 ` Markus Elfring
2020-04-17 16:15 ` Suman Anna
2020-04-17 16:15 ` Suman Anna
2020-04-17 20:58 ` Mathieu Poirier
2020-04-17 20:58 ` Mathieu Poirier
2020-04-17 21:28 ` [PATCH v2 " Mathieu Poirier
2020-04-17 21:28 ` Mathieu Poirier
2020-04-15 20:48 ` [PATCH v2 6/7] remoteproc: Split rproc_ops allocation from rproc_alloc() Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-17 13:49 ` Suman Anna
2020-04-17 13:49 ` Suman Anna
2020-04-17 15:35 ` Suman Anna
2020-04-17 15:35 ` Suman Anna
2020-04-17 21:56 ` Mathieu Poirier
2020-04-17 21:56 ` Mathieu Poirier
2020-04-15 20:48 ` [PATCH v2 7/7] remoteproc: Get rid of tedious error path Mathieu Poirier
2020-04-15 20:48 ` Mathieu Poirier
2020-04-17 13:50 ` Suman Anna
2020-04-17 13:50 ` Suman Anna
2020-04-17 13:34 ` [PATCH v2 0/7] remoteproc: Refactor function rproc_alloc() Suman Anna
2020-04-17 13:34 ` Suman Anna
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=3f0a602a-64ff-8092-3cca-b63bab8a79f0@ti.com \
--to=s-anna@ti.com \
--cc=Markus.Elfring@web.de \
--cc=bjorn.andersson@linaro.org \
--cc=elder@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
/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).