linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-netx] net: renesas: sh_eth: suppress initialized field overwritten warning
@ 2020-09-19 10:59 Liu Jian
  2020-09-20 21:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Jian @ 2020-09-19 10:59 UTC (permalink / raw)
  To: sergei.shtylyov, davem, kuba, liujian56, netdev, linux-renesas-soc

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>
---
 drivers/net/ethernet/renesas/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/renesas/Makefile b/drivers/net/ethernet/renesas/Makefile
index f21ab8c02af0..ccb8521d190b 100644
--- a/drivers/net/ethernet/renesas/Makefile
+++ b/drivers/net/ethernet/renesas/Makefile
@@ -3,6 +3,7 @@
 # Makefile for the Renesas device drivers.
 #
 
+CFLAGS_sh_eth.o += -Wno-override-init
 obj-$(CONFIG_SH_ETH) += sh_eth.o
 
 ravb-objs := ravb_main.o ravb_ptp.o
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-netx] net: renesas: sh_eth: suppress initialized field overwritten warning
  2020-09-19 10:59 [PATCH net-netx] net: renesas: sh_eth: suppress initialized field overwritten warning Liu Jian
@ 2020-09-20 21:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-20 21:28 UTC (permalink / raw)
  To: liujian56; +Cc: sergei.shtylyov, kuba, netdev, linux-renesas-soc

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-20 21:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 10:59 [PATCH net-netx] net: renesas: sh_eth: suppress initialized field overwritten warning Liu Jian
2020-09-20 21:28 ` David Miller

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).