From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Manish Badarkhe
<badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH V2] regulator: fixed: update to devm_* API
Date: Mon, 27 Jan 2014 22:33:08 -0800 [thread overview]
Message-ID: <20140128063308.GA5965@core.coreip.homeip.net> (raw)
In-Reply-To: <1390878720-8676-1-git-send-email-badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi Manish,
On Tue, Jan 28, 2014 at 08:42:00AM +0530, Manish Badarkhe wrote:
> Update the code to use devm_* API so that driver core will manage
> resources.
>
> Signed-off-by: Manish Badarkhe <badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> Changes since V1:
> 1. Updated driver to use "devm_kzalloc" to "kstrdup".
> 2. Updated commit message.
>
> Not tested on any board.
>
> :100644 100644 5ea64b9... e9763a4... M drivers/regulator/fixed.c
> drivers/regulator/fixed.c | 42 ++++++++++++------------------------------
> 1 file changed, 12 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index 5ea64b9..e9763a4 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -132,15 +132,15 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
> GFP_KERNEL);
> if (drvdata == NULL) {
> dev_err(&pdev->dev, "Failed to allocate device data\n");
> - ret = -ENOMEM;
> - goto err;
> + return -ENOMEM;
> }
>
> - drvdata->desc.name = kstrdup(config->supply_name, GFP_KERNEL);
> + drvdata->desc.name = devm_kzalloc(&pdev->dev,
> + strlen(config->supply_name) + 1,
> + GFP_KERNEL);
> if (drvdata->desc.name == NULL) {
> dev_err(&pdev->dev, "Failed to allocate supply name\n");
> - ret = -ENOMEM;
> - goto err;
> + return -ENOMEM;
> }
Umm, I am fairly certain that devm_kzalloc() can't be used as a
substitute for kstrdup, at least not without accompanying memcpy.
Thanks.
--
Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Manish Badarkhe <badarkhe.manish@gmail.com>
Cc: linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
broonie@kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH V2] regulator: fixed: update to devm_* API
Date: Mon, 27 Jan 2014 22:33:08 -0800 [thread overview]
Message-ID: <20140128063308.GA5965@core.coreip.homeip.net> (raw)
In-Reply-To: <1390878720-8676-1-git-send-email-badarkhe.manish@gmail.com>
Hi Manish,
On Tue, Jan 28, 2014 at 08:42:00AM +0530, Manish Badarkhe wrote:
> Update the code to use devm_* API so that driver core will manage
> resources.
>
> Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
> ---
> Changes since V1:
> 1. Updated driver to use "devm_kzalloc" to "kstrdup".
> 2. Updated commit message.
>
> Not tested on any board.
>
> :100644 100644 5ea64b9... e9763a4... M drivers/regulator/fixed.c
> drivers/regulator/fixed.c | 42 ++++++++++++------------------------------
> 1 file changed, 12 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index 5ea64b9..e9763a4 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -132,15 +132,15 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
> GFP_KERNEL);
> if (drvdata == NULL) {
> dev_err(&pdev->dev, "Failed to allocate device data\n");
> - ret = -ENOMEM;
> - goto err;
> + return -ENOMEM;
> }
>
> - drvdata->desc.name = kstrdup(config->supply_name, GFP_KERNEL);
> + drvdata->desc.name = devm_kzalloc(&pdev->dev,
> + strlen(config->supply_name) + 1,
> + GFP_KERNEL);
> if (drvdata->desc.name == NULL) {
> dev_err(&pdev->dev, "Failed to allocate supply name\n");
> - ret = -ENOMEM;
> - goto err;
> + return -ENOMEM;
> }
Umm, I am fairly certain that devm_kzalloc() can't be used as a
substitute for kstrdup, at least not without accompanying memcpy.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2014-01-28 6:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 3:12 [PATCH V2] regulator: fixed: update to devm_* API Manish Badarkhe
[not found] ` <1390878720-8676-1-git-send-email-badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-28 6:33 ` Dmitry Torokhov [this message]
2014-01-28 6:33 ` Dmitry Torokhov
2014-01-28 7:16 ` Manish Badarkhe
2014-01-28 7:38 ` Heiko Stübner
2014-01-28 8:46 ` Manish Badarkhe
[not found] ` <CAKDJKT4jPLmtrm6Ngp+nT5vf0H4zXwwAM=oURDF-DSAJodVN6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-28 8:55 ` Heiko Stübner
2014-01-28 8:55 ` Heiko Stübner
2014-01-28 9:01 ` Manish Badarkhe
2014-01-28 9:01 ` Manish Badarkhe
2014-01-28 10:45 ` Mark Brown
2014-01-28 17:36 ` Manish Badarkhe
2014-01-28 16:41 ` Stephen Warren
2014-01-28 16:41 ` Stephen Warren
2014-01-28 17:06 ` Manish Badarkhe
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=20140128063308.GA5965@core.coreip.homeip.net \
--to=dmitry.torokhov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=badarkhe.manish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.