public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Alim Akhtar <alim.akhtar@gmail.com>,
	yalin wang <yalin.wang2010@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	ben@decadent.org.uk, Jaehoon Chung <jh80.chung@samsung.com>,
	asaf.vertz@tandemg.com, tklauser@distanz.ch,
	jonathanh@nvidia.com,
	"James E.J. Bottomley" <JBottomley@odin.com>,
	Grant Grundler <grundler@chromium.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mmc: change to use kmalloc
Date: Wed, 11 Nov 2015 16:17:46 -0500	[thread overview]
Message-ID: <5643B07A.3090208@hurleysoftware.com> (raw)
In-Reply-To: <CAGOxZ53m0Fiudgt-gUBH2QhOW291tVmx1pFyeX5qmO_3kHQvSQ@mail.gmail.com>

On 11/11/2015 12:02 PM, Alim Akhtar wrote:
> Hi Yalin,
> 
> On Wed, Nov 11, 2015 at 9:53 AM, yalin wang <yalin.wang2010@gmail.com> 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.

Regards,
Peter Hurley

>> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
>> ---
>>  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


  reply	other threads:[~2015-11-11 21:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11  4:23 [PATCH] mmc: change to use kmalloc yalin wang
2015-11-11 17:02 ` Alim Akhtar
2015-11-11 21:17   ` Peter Hurley [this message]
2015-11-11 21:57     ` Andy Shevchenko
2015-11-12 11:27       ` yalin wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5643B07A.3090208@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=JBottomley@odin.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@gmail.com \
    --cc=asaf.vertz@tandemg.com \
    --cc=ben@decadent.org.uk \
    --cc=grundler@chromium.org \
    --cc=jh80.chung@samsung.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tklauser@distanz.ch \
    --cc=ulf.hansson@linaro.org \
    --cc=yalin.wang2010@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox