From: Marco Stornelli <marco.stornelli@gmail.com>
To: yidong zhang <zhangyd6@gmail.com>
Cc: linux-embedded@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, tim.bird@am.sony.com,
akpm@linux-foundation.org
Subject: Re: [PATCH 02/16 v3] pramfs: super operations
Date: Mon, 15 Nov 2010 08:45:56 +0100 [thread overview]
Message-ID: <AANLkTimn=Yp-tzb6f-=M73+1Rjqbtp+fxWLH4bz7HEuJ@mail.gmail.com> (raw)
In-Reply-To: <AANLkTiky=Vnxnav4VtX_Yd1sUtFGqHTrd=aih8qRJ7u7@mail.gmail.com>
2010/11/15 yidong zhang <zhangyd6@gmail.com>:
> hi Marco
>
>> + retval = 0;
>> + out:
>> + if (retval && sbi->virt_addr) {
>> + iounmap(sbi->virt_addr);
>> + release_mem_region(sbi->phys_addr, initsize);
>> + kfree(sbi);
>> + }
>> +
>> + return retval;
>> +}
>> +
> I think kfree(sbi) should not be put here. In case of
> pram_parse_options failure, sbi should also be freed too. How about
> change it to the list below? And change some “goto out” branches to
> “goto out_free”.
>
> // retval = 0;
> return 0;
> out:
> if (retval && sbi->virt_addr) {
> iounmap(sbi->virt_addr);
> release_mem_region(sbi->phys_addr, initsize);
> }
> out_free:
> kfree(sbi);
> return retval;
> }
>
Yeah, you're right. It's not always true that virt addr is valid,
kfree should be used out of this if. I'll fix it.
Marco
prev parent reply other threads:[~2010-11-15 7:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-13 14:48 [PATCH 02/16 v3] pramfs: super operations Marco Stornelli
2010-11-15 2:27 ` yidong zhang
2010-11-15 7:45 ` Marco Stornelli [this message]
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='AANLkTimn=Yp-tzb6f-=M73+1Rjqbtp+fxWLH4bz7HEuJ@mail.gmail.com' \
--to=marco.stornelli@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tim.bird@am.sony.com \
--cc=zhangyd6@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;
as well as URLs for NNTP newsgroup(s).