From: Steven Rostedt <rostedt@goodmis.org>
To: Rafa?? Mi??ecki <zajec5@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andy Botting <andy@andybotting.com>
Subject: Re: Crash with kfree(null) on MacBook? kobject_set_name_vargs
Date: Wed, 27 Apr 2011 10:03:33 -0400 [thread overview]
Message-ID: <20110427140333.GA22909@home.goodmis.org> (raw)
In-Reply-To: <BANLkTincyn_2FrSYwJnNNnYE9WdyVzoHFA@mail.gmail.com>
On Mon, Apr 11, 2011 at 09:38:02PM +0200, Rafa?? Mi??ecki wrote:
> Thank you Linus, now when you made it clear to me that NULL ~!= NULL,
> I realized I didn't zeroed struct which contains struct dev.
>
> struct axi_device core;
> vs.
> struct axi_device core = { };
The two are identical. If they are declared as globals or static. As
globals and static variables are initialized to zero at start up.
Is this on the stack or global? If on the stack, you need the
initializer, if it is global you do not.
IOW:
struct axi_device core;
static struct axi_device core;
void func(void)
{
static struct axi_device core;
[...]
All the above is OK with no initializer.
void func(void)
{
struct axi_device core = {};
This does need an initializer, but gcc should complain if you use core
without initializing.
-- Steve
prev parent reply other threads:[~2011-04-27 14:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-10 17:14 Rafał Miłecki
2011-04-10 17:15 ` Rafał Miłecki
2011-04-10 21:28 ` Bob Copeland
2011-04-11 17:28 ` Rafał Miłecki
2011-04-11 17:41 ` Linus Torvalds
2011-04-11 17:48 ` Linus Torvalds
2011-04-11 19:38 ` Rafał Miłecki
2011-04-27 14:03 ` Steven Rostedt [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=20110427140333.GA22909@home.goodmis.org \
--to=rostedt@goodmis.org \
--cc=andy@andybotting.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=zajec5@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
all inboxes | Powered by JetHome®