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

From: Boris Brezillon
Date: Mon Jan 02 2017 - 03:52:05 EST


On Mon, 2 Jan 2017 13:26:01 +0530
Arvind Yadav <arvind.yadav.cs@xxxxxxxxx> 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.