Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753370AbcLKIEO (ORCPT ); Sun, 11 Dec 2016 03:04:14 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36233 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753171AbcLKIEM (ORCPT ); Sun, 11 Dec 2016 03:04:12 -0500 Subject: Re: [PATCH V1] pinctrl:pxa:pinctrl-pxa2xx:- No need of devm functions To: Robert Jarzmik References: <1481207730-6332-1-git-send-email-arvind.yadav.cs@gmail.com> <87eg1g16r8.fsf@belgarion.home> Cc: daniel@zonque.org, haojian.zhuang@gmail.com, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org From: arvind Yadav Message-ID: Date: Sun, 11 Dec 2016 13:34:06 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <87eg1g16r8.fsf@belgarion.home> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1000 Lines: 27 Yes, It will not fixes any defect. But 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. -Arvind On Saturday 10 December 2016 02:49 PM, Robert Jarzmik wrote: > Arvind Yadav writes: > > Hi Arvind, > >> In functions pxa2xx_build_functions, the memory allocated for >> 'functions' is live within the function only. After the >> allocation it is immediately freed with devm_kfree. There is >> no need to allocate memory for 'functions' with devm function >> so replace devm_kcalloc with kcalloc and devm_kfree with kfree. > That's not very true : the "need" is to spare the "manual" kfree you're adding > in your patch for one, and make it consistent with pxa2xx_build_groups() and > pxa2xx_build_state() for two. > > Therefore I'm not very thrilled by this patch and unless it fixes a defect in > the driver I'd rather not have it in. > > Cheers. > > -- > Robert