All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: warning in omap_connector
Date: Tue, 30 Jun 2020 17:39:02 +0300	[thread overview]
Message-ID: <20200630143902.GG6112@intel.com> (raw)
In-Reply-To: <CADnq5_PdqNjD2OnWGWJxv-Q-YUN4ymLUxTdT9km_ESS2cwm68A@mail.gmail.com>

On Tue, Jun 30, 2020 at 10:19:23AM -0400, Alex Deucher wrote:
> On Tue, Jun 30, 2020 at 10:15 AM Ville Syrjälä
> <ville.syrjala@linux.intel.com> wrote:
> >
> > On Tue, Jun 30, 2020 at 04:33:37PM +1000, Dave Airlie wrote:
> > > Hey Laurent,
> > >
> > > I merged drm-misc-next and noticed this, I'm not sure if it's
> > > collateral damage from something else changing or I've just missed it
> > > previously. 32-bit arm build.
> > >
> > >
> > > /home/airlied/devel/kernel/dim/src/drivers/gpu/drm/omapdrm/omap_connector.c:
> > > In function ‘omap_connector_mode_valid’:
> > > /home/airlied/devel/kernel/dim/src/drivers/gpu/drm/omapdrm/omap_connector.c:92:9:
> > > warning: braces around scalar initializer
> > >   struct drm_display_mode new_mode = { { 0 } };
> >
> > Probably fallout from my drm_display_mode shrinkage.
> >
> > Going to repeat my usual "just use {} when zero initializing
> > structs" recommendation. Avoids these stupid warnings, and IMO
> > also conveys the meaning better since there's no ambiguity
> > between zero initializing the whole struct vs. zero initializing
> > just the first member.
> 
> IIRC, LLVM and GCC treat these slightly differently.  We've generally
> just moved to using memset to avoid different compiler complaints when
> using these.

I don't particularly like memset() since the requirement to
pass the size just adds another way to screw things up. The
usual 'sizeof(*thing)' makes that slightly less of an issue,
but I've noticed that people often don't use that.

Another issue with memset() is that you then can end up with
a block of seemingly random collection of memsets()s between
the variable declarations and the rest of the code. I suppose
if we could declare variables anywhere we could always keep
the two together so it wouldn't look so weird, but can't do
that for the time being. And even with that it would still
lead to less succinct code, which I generally dislike.

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-06-30 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  6:33 warning in omap_connector Dave Airlie
2020-06-30 14:15 ` Ville Syrjälä
2020-06-30 14:19   ` Alex Deucher
2020-06-30 14:39     ` Ville Syrjälä [this message]
2020-06-30 14:41       ` Laurent Pinchart
2020-06-30 15:07         ` Ville Syrjälä
2020-07-23  4:28           ` Dave Airlie
2020-07-24 21:08             ` Laurent Pinchart

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=20200630143902.GG6112@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.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.