From: Alban Bedel <alban.bedel@avionic-design.de>
To: Oliver Neukum <oneukum@suse.com>
Cc: Alban Bedel <alban.bedel@avionic-design.de>,
Freddy Xin <freddy@asix.com.tw>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH] usbnet: ax88179_178a: Add support for writing the EEPROM
Date: Thu, 25 Aug 2016 12:07:33 +0200 [thread overview]
Message-ID: <20160825120733.3413d395@avionic-0020> (raw)
In-Reply-To: <1472116596.2877.23.camel@suse.com>
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]
On Thu, 25 Aug 2016 11:16:36 +0200
Oliver Neukum <oneukum@suse.com> wrote:
> On Wed, 2016-08-24 at 16:40 +0200, Alban Bedel wrote:
> > On Wed, 24 Aug 2016 16:30:39 +0200
> > Oliver Neukum <oneukum@suse.com> wrote:
> >
> > > On Wed, 2016-08-24 at 15:52 +0200, Alban Bedel wrote:
>
> > > > + if (block != data)
> > > > + kfree(block);
> > >
> > > And if block == dta, what frees the memory?
> >
> > In this case this function didn't allocate any memory, so there is
> > nothing to free.
>
> Hi,
>
> I see. kfree() has a check for NULL, so you could drop the
> test, but it doesn't matter much either way.
I think you misunderstand something here. data is the buffer passed
by the caller and block is a local variable. There is two cases:
1) The data to write is block aligned, then we use the caller buffer
as is and set block = data.
2) The requested data is not block aligned, then we kalloc block.
In both case the writing loop then use the block pointer. Afterwards
we only need to kfree block in case 2, that is when block != data.
Alban
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-08-25 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 13:52 [PATCH] usbnet: ax88179_178a: Add support for writing the EEPROM Alban Bedel
2016-08-24 14:30 ` Oliver Neukum
2016-08-24 14:40 ` Alban Bedel
2016-08-25 9:16 ` Oliver Neukum
2016-08-25 10:07 ` Alban Bedel [this message]
2016-08-25 10:08 ` Oliver Neukum
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=20160825120733.3413d395@avionic-0020 \
--to=alban.bedel@avionic-design.de \
--cc=freddy@asix.com.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.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;
as well as URLs for NNTP newsgroup(s).