[PATCH V1] mtd : nand : denali :- No need of devm functions

Boris Brezillon boris.brezillon at free-electrons.com
Mon Jan 2 00:51:58 PST 2017


On Mon, 2 Jan 2017 13:26:01 +0530
Arvind Yadav <arvind.yadav.cs at gmail.com> wrote:

> yes, if Memory is live out side function. Then devm_kzalloc()
> approach has the benefit of simplifying the different error paths.
> 
> Here, Memory is alive with in function. we are going to free allocate memory
> then why we need devm api. In this case Devm will first add this entry to
> list and immediately it will remove from list. In this case, It's just a 
> overhead
> for devm api.

Yes, it adds a small overhead, but ITOH, it simplifies the code (see
the kfree() calls you added in different error paths with your
approach). Sometime a small runtime overhead (especially when the code
is executed once at probe time) is acceptable if it improves
readability.





More information about the linux-mtd mailing list