From: Dan Carpenter <dan.carpenter@oracle.com>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
devel@driverdev.osuosl.org, linux-media@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 4.20 056/117] media: cedrus: don't initialize pointers with zero
Date: Wed, 9 Jan 2019 11:48:54 +0300 [thread overview]
Message-ID: <20190109084854.GA1743@kadam> (raw)
In-Reply-To: <20190108192628.121270-56-sashal@kernel.org>
This is a pure cleanup patch, it doesn't affect runtime.
On Tue, Jan 08, 2019 at 02:25:24PM -0500, Sasha Levin wrote:
> From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>
> [ Upstream commit e4d7b113fdccde1acf8638c5879f2a450d492303 ]
>
> A common mistake is to assume that initializing a var with:
> struct foo f = { 0 };
>
> Would initialize a zeroed struct. Actually, what this does is
> to initialize the first element of the struct to zero.
>
> According to C99 Standard 6.7.8.21:
>
> "If there are fewer initializers in a brace-enclosed
> list than there are elements or members of an aggregate,
> or fewer characters in a string literal used to initialize
> an array of known size than there are elements in the array,
> the remainder of the aggregate shall be initialized implicitly
> the same as objects that have static storage duration."
Static storage is initialized to zero so this is fine. It's just
that Sparse complains if you mix NULL and zero.
regards,
dan carpenter
next prev parent reply other threads:[~2019-01-09 8:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190108192628.121270-1-sashal@kernel.org>
2019-01-08 19:25 ` [PATCH AUTOSEL 4.20 046/117] media: uvcvideo: Refactor teardown of uvc on USB disconnect Sasha Levin
2019-01-08 19:25 ` [PATCH AUTOSEL 4.20 050/117] media: firewire: Fix app_info parameter type in avc_ca{,_app}_info Sasha Levin
2019-01-08 19:25 ` [PATCH AUTOSEL 4.20 054/117] media: venus: core: Set dma maximum segment size Sasha Levin
2019-01-08 19:25 ` [PATCH AUTOSEL 4.20 056/117] media: cedrus: don't initialize pointers with zero Sasha Levin
2019-01-09 8:48 ` Dan Carpenter [this message]
2019-01-23 14:04 ` Sasha Levin
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=20190109084854.GA1743@kadam \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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