Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: liujian56@huawei.com
Cc: sergei.shtylyov@gmail.com, kuba@kernel.org,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net-netx] net: renesas: sh_eth: suppress initialized field overwritten warning
Date: Sun, 20 Sep 2020 14:28:28 -0700 (PDT)	[thread overview]
Message-ID: <20200920.142828.1649305713979064139.davem@davemloft.net> (raw)
In-Reply-To: <20200919105945.251532-1-liujian56@huawei.com>

From: Liu Jian <liujian56@huawei.com>
Date: Sat, 19 Sep 2020 18:59:45 +0800

> Suppress a bunch of warnings of the form:
> 
> drivers/net/ethernet/renesas/sh_eth.c:100:13: warning: initialized field overwritten [-Woverride-init]
> 
> This is because after the sh_eth_offset_xxx array is initialized to SH_ETH_OFFSET_INVALID,
> some specific register_offsets are re-initialized. It wasn't a mistake.
> 
> Signed-off-by: Liu Jian <liujian56@huawei.com>

Even if I agreed with this approach to the fix, you can't just blindly
add a CFLAG option.  What if the compile doesn't understand or support
that option?

I leave it to the patch submitter to grep the Makefiles in the tree to
learn how to handle this situation properly, because that's how I
learned what the right thing to do since I wasn't sure.

But in the end I think just sticking a warning disable here and there
isn't the solution.  I think this driver should explicitly initialize
the array entries that are invalid on each and every chip.

No only does that get rid of the warnings cleanly, but it also more
clearly documents the available register set.  Currently you have to
walk each and every enumeration value in the sh_eth.h header and
see if the table has it or not, in order to figure out which registers
are _not_ present for a chip.

Thank you.

      reply	other threads:[~2020-09-20 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-19 10:59 Liu Jian
2020-09-20 21:28 ` David Miller [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=20200920.142828.1649305713979064139.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=liujian56@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@gmail.com \
    --subject='Re: [PATCH net-netx] net: renesas: sh_eth: suppress initialized field overwritten warning' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).