From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755489AbdABIwC (ORCPT ); Mon, 2 Jan 2017 03:52:02 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:34544 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755210AbdABIwA (ORCPT ); Mon, 2 Jan 2017 03:52:00 -0500 Date: Mon, 2 Jan 2017 09:51:58 +0100 From: Boris Brezillon To: Arvind Yadav Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, cyrille.pitchen@atmel.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V1] mtd : nand : denali :- No need of devm functions Message-ID: <20170102095158.2394cf93@bbrezillon> In-Reply-To: <4bf4a97b-c2c3-51db-9bb1-61e6d433c7ca@gmail.com> References: <1481123711-7205-1-git-send-email-arvind.yadav.cs@gmail.com> <20161229182443.2bdb37a7@bbrezillon> <4bf4a97b-c2c3-51db-9bb1-61e6d433c7ca@gmail.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 Jan 2017 13:26:01 +0530 Arvind Yadav 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.