From: Guenter Roeck <linux@roeck-us.net>
To: Himangi Saraogi <himangi774@gmail.com>
Cc: Jean Delvare <jdelvare@suse.de>,
lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org,
julia.lawall@lip6.fr
Subject: Re: [PATCH v2] hwmon: Introduce the use of the managed version of kzalloc
Date: Tue, 20 May 2014 13:03:36 -0700 [thread overview]
Message-ID: <20140520200336.GA11723@roeck-us.net> (raw)
In-Reply-To: <20140520181536.GA11483@himangi-Dell>
On Tue, May 20, 2014 at 11:45:37PM +0530, Himangi Saraogi wrote:
> This patch moves data allocated using kzalloc to managed data allocated
> using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
> functions. Also, the unnecessary label out_free is removed.
>
> The following Coccinelle semantic patch was used for making the change:
>
> @platform@
> identifier p, probefn, removefn;
> @@
> struct platform_driver p = {
> .probe = probefn,
> .remove = removefn,
> };
>
> @prb@
> identifier platform.probefn, pdev;
> expression e, e1, e2;
> @@
> probefn(struct platform_device *pdev, ...) {
> <+...
> - e = kzalloc(e1, e2)
> + e = devm_kzalloc(&pdev->dev, e1, e2)
> ...
> ?-kfree(e);
> ...+>
> }
>
> @rem depends on prb@
> identifier platform.removefn;
> expression e;
> @@
> removefn(...) {
> <...
> - kfree(e);
> ...>
> }
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Applied to -next, just for the sake of it, but frankly that driver
is screwed up so badly that it is pretty much unusable anyway.
Almost all of its attributes are non-standard, and for most of them
that is completely unnecsssary.
Maybe we should create a to-be-removed list and put it there
as first candidate.
Guenter
next prev parent reply other threads:[~2014-05-20 20:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 18:15 [PATCH v2] hwmon: Introduce the use of the managed version of kzalloc Himangi Saraogi
2014-05-20 20:03 ` Guenter Roeck [this message]
2014-05-20 21:20 ` Jean Delvare
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=20140520200336.GA11723@roeck-us.net \
--to=linux@roeck-us.net \
--cc=himangi774@gmail.com \
--cc=jdelvare@suse.de \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.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