Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754243AbbKLL1y (ORCPT ); Thu, 12 Nov 2015 06:27:54 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34140 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753876AbbKLL1w convert rfc822-to-8bit (ORCPT ); Thu, 12 Nov 2015 06:27:52 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: Re: [PATCH] mmc: change to use kmalloc From: yalin wang In-Reply-To: Date: Thu, 12 Nov 2015 19:27:42 +0800 Cc: Peter Hurley , Alim Akhtar , Ulf Hansson , Adrian Hunter , Ben Hutchings , Jaehoon Chung , asaf.vertz@tandemg.com, Tobias Klauser , Jon Hunter , "James E.J. Bottomley" , Grant Grundler , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Transfer-Encoding: 8BIT Message-Id: References: <1447215791-19429-1-git-send-email-yalin.wang2010@gmail.com> <5643B07A.3090208@hurleysoftware.com> To: Andy Shevchenko X-Mailer: Apple Mail (2.3094) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2090 Lines: 64 > On Nov 12, 2015, at 05:57, Andy Shevchenko wrote: > > On Wed, Nov 11, 2015 at 11:17 PM, Peter Hurley wrote: >> On 11/11/2015 12:02 PM, Alim Akhtar wrote: >>> Hi Yalin, >>> >>> On Wed, Nov 11, 2015 at 9:53 AM, yalin wang wrote: >>>> Use kmalloc instead of kzalloc, zero the memory is not needed. >>>> >>> why you want to do this? what problem you faces, and how this resolves the same? >> >> The patch fixes an inefficiency: explicitly zeroing memory that is then >> immediately overwritten 6 lines below is wasteful. > > It might fix previous kzalloc as well, though better not to do since > it's error prone. > yeah, i will send a new patch , >> >> Regards, >> Peter Hurley >> >>>> Signed-off-by: yalin wang >>>> --- >>>> drivers/mmc/card/block.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c >>>> index 23b6c8e..975cd3e 100644 >>>> --- a/drivers/mmc/card/block.c >>>> +++ b/drivers/mmc/card/block.c >>>> @@ -365,7 +365,7 @@ static struct mmc_blk_ioc_data *mmc_blk_ioctl_copy_from_user( >>>> if (!idata->buf_bytes) >>>> return idata; >>>> >>>> - idata->buf = kzalloc(idata->buf_bytes, GFP_KERNEL); >>>> + idata->buf = kmalloc(idata->buf_bytes, GFP_KERNEL); >>>> if (!idata->buf) { >>>> err = -ENOMEM; >>>> goto idata_err; >>>> -- >>>> 1.9.1 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> Please read the FAQ at http://www.tux.org/lkml/ > > > > -- > With Best Regards, > Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/