From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752005AbdJTOs1 (ORCPT ); Fri, 20 Oct 2017 10:48:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39668 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbdJTOs0 (ORCPT ); Fri, 20 Oct 2017 10:48:26 -0400 Date: Fri, 20 Oct 2017 16:48:33 +0200 From: Greg KH To: Masahiro Yamada Cc: Srinivas Kandagatla , Linux Kernel Mailing List Subject: Re: [PATCH 02/12] nvmem: mtk-efuse: use stack for nvmem_config instead of malloc'ing it Message-ID: <20171020144833.GB8965@kroah.com> References: <20171009132641.27169-1-srinivas.kandagatla@linaro.org> <20171009132641.27169-3-srinivas.kandagatla@linaro.org> <20171020133455.GD9301@kroah.com> <20171020135423.GC20327@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 10:59:45PM +0900, Masahiro Yamada wrote: > 2017-10-20 22:54 GMT+09:00 Greg KH : > > On Fri, Oct 20, 2017 at 10:47:28PM +0900, Masahiro Yamada wrote: > >> 2017-10-20 22:34 GMT+09:00 Greg KH : > >> > On Mon, Oct 09, 2017 at 03:26:31PM +0200, srinivas.kandagatla@linaro.org wrote: > >> >> From: Masahiro Yamada > >> >> > >> >> nvmem_register() copies all the members of nvmem_config to > >> >> nvmem_device. So, nvmem_config is one-time use data during > >> >> probing. There is no point to keep it until the driver detach. > >> >> Using stack should be no problem because nvmem_config is pretty > >> >> small. > >> > > >> > Same objection as previous patch, what is wrong with it as-is? > >> > > >> > >> It is wasting memory. > > > > The memory is freed again, after the call, right? > > > > I assume your "as-is" meant devm_kzalloc(). > > The memory is freed when the driver is detached. > > It is generally quite long time > that this struct occupies the memory for no good reason. Ah, ok, a simple kmalloc() might be better, but ok, if you are _sure_ it's ok taking that much stack space up... :) thanks, greg k-h