On Thu, Jul 29, 2021 at 07:56:27AM +0200, Greg Kroah-Hartman wrote:
On Wed, Jul 28, 2021 at 11:37:30PM +0200, David Sterba wrote:
quoted
On Wed, Jul 28, 2021 at 02:37:20PM -0700, Bart Van Assche wrote:
quoted
On 7/28/21 2:14 AM, Dan Carpenter wrote:
quoted
On Wed, Jul 28, 2021 at 10:59:22AM +0200, David Sterba wrote:
quoted
quoted
drivers/media/platform/omap3isp/ispstat.c | 5 +--
include/uapi/linux/omap3isp.h | 44 +++++++++++++++++------
2 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index 5b9b57f4d9bf..ea8222fed38e 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -512,7 +512,7 @@ int omap3isp_stat_request_statistics(struct ispstat *stat,
int omap3isp_stat_request_statistics_time32(struct ispstat *stat,
struct omap3isp_stat_data_time32 *data)
{
- struct omap3isp_stat_data data64;
+ struct omap3isp_stat_data data64 = { };
Should this be { 0 } ?
We've seen patches trying to switch from { 0 } to { } but the answer
was that { 0 } is supposed to be used,
http://www.ex-parrot.com/~chris/random/initialise.html
(from https://lore.kernel.org/lkml/fbddb15a-6e46-3f21-23ba-b18f66e3448a@suse.com/ (local) )
In the kernel we don't care about portability so much. Use the = { }
GCC extension. If the first member of the struct is a pointer then
Sparse will complain about = { 0 }.
+1 for { }.
Oh, I thought the tendency is is to use { 0 } because that can also
intialize the compound members, by a "scalar 0" as it appears in the
code.
Holes in the structure might not be initialized to anything if you do
either one of these as well.
Or did we finally prove that is not the case? I can not remember
anymore...
Yep. The C11 spec says that struct holes are initialized.
https://lore.kernel.org/netdev/20200731140452.GE24045@ziepe.ca/ (local)
What doesn't initialize struct holes is assignments:
struct foo foo = *bar;
regards,
dan carpenter