[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140520200336.GA11723@roeck-us.net>
Date: Tue, 20 May 2014 13:03:36 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Himangi Saraogi <himangi774@...il.com>
Cc: Jean Delvare <jdelvare@...e.de>, lm-sensors@...sensors.org,
linux-kernel@...r.kernel.org, julia.lawall@...6.fr
Subject: Re: [PATCH v2] hwmon: Introduce the use of the managed version of
kzalloc
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists