All of lore.kernel.org
 help / color / mirror / Atom feed
From: blp@cs.stanford.edu (Ben Pfaff)
To: Josh Triplett <josh@joshtriplett.org>
Cc: Chris Ball <cjb@laptop.org>, Venkatraman S <svenkatr@ti.com>,
	linux-mmc@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: [PATCH 2/2] mmc: fix integer assignments to pointer
Date: Tue, 23 Aug 2011 11:04:08 -0700	[thread overview]
Message-ID: <874o18m2cn.fsf@blp.benpfaff.org> (raw)
In-Reply-To: <20110823172851.GB1784@leaf> (Josh Triplett's message of "Tue, 23 Aug 2011 10:28:51 -0700")

Josh Triplett <josh@joshtriplett.org> writes:

> On Tue, Aug 23, 2011 at 12:31:55PM -0400, Chris Ball wrote:
>> On Tue, Aug 23 2011, Venkatraman S wrote:
>> > -	struct mmc_request mrq = {0};
>> > +	struct mmc_request mrq = {NULL};
>> 
>> The sparse warning is mistaken.  Or I'm mistaken.  But I suspect it's
>> the sparse warning.
>
> Notice that it says "the remainder of the aggregate".  The first field
> still gets initialized with the 0 you supplied, and the first field of
> struct mmc_request has a pointer type.

That's an understandable position, but I think it would also be
reasonable for sparse to special case using {0} as an
initializer.  {0} is a valid initializer for every type and so
it's sometimes used as an initializer for a local variable to get
the same effect that one would have for a static variable without
specifying an initializer.
-- 
Ben Pfaff 
http://benpfaff.org

  reply	other threads:[~2011-08-23 18:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 15:46 [PATCH 0/2] mmc: trivial patches to fix sparse warnings Venkatraman S
2011-08-23 15:46 ` [PATCH 1/2] mmc: queue: declare mmc_alloc_sg as static Venkatraman S
2011-08-23 15:46 ` [PATCH 2/2] mmc: fix integer assignments to pointer Venkatraman S
2011-08-23 16:31   ` Chris Ball
2011-08-23 16:56     ` Sam Ravnborg
2011-08-23 17:36       ` Chris Ball
2011-08-23 22:40       ` J Freyensee
2011-08-24 11:23         ` S, Venkatraman
2011-08-23 17:28     ` Josh Triplett
2011-08-23 18:04       ` Ben Pfaff [this message]
2011-08-23 18:13         ` Josh Triplett
2011-08-23 18:28           ` Chris Ball
2011-08-23 20:22             ` Sam Ravnborg
2011-08-23 20:38             ` Sam Ravnborg
2011-08-24 18:33               ` S, Venkatraman
2011-08-23 20:43           ` Ben Pfaff

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=874o18m2cn.fsf@blp.benpfaff.org \
    --to=blp@cs.stanford.edu \
    --cc=cjb@laptop.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=svenkatr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.