linux_dsm_epyc7002/drivers/net/dsa
Arnd Bergmann 5eca2914f3 dsa: b53: avoid 'maybe-uninitialized' warning
In some configurations, gcc produces a warning for correct code
in this driver:

drivers/net/dsa/b53/b53_mmap.c: In function 'b53_mmap_read64':
drivers/net/dsa/b53/b53_mmap.c:107:10: error: 'hi' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  *val = ((u64)hi << 32) | lo;
          ^~~~~~~
drivers/net/dsa/b53/b53_mmap.c: In function 'b53_mmap_read48':
drivers/net/dsa/b53/b53_mmap.c:91:11: error: 'hi' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   *val = ((u64)hi << 32) | lo;
           ^~~~~~~
drivers/net/dsa/b53/b53_mmap.c:83:11: error: 'hi' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   *val = ((u64)hi << 16) | lo;

I have seen the warning before and at the time thought I had fixed
it with 55e7f6abe1 ("dsa: b53: fix big-endian register access"),
however it now came back in a different randconfig build that happens
to have different inlining decisions in the compiler.

The mistake that gcc makes here is that it thinks the second call to
readl() might fail because the address 'reg + 4' is not a multiple
of four despite having knowing that 'reg' itself is a multiple of four.

By open-coding the two reads without the redundant alignment check,
we can avoid the warning and produce slightly better object code, but
get slightly longer source code instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-29 05:07:12 -04:00
..
b53 dsa: b53: avoid 'maybe-uninitialized' warning 2016-06-29 05:07:12 -04:00
mv88e6xxx net: dsa: mv88e6xxx: rename single-chip support 2016-06-25 11:29:47 -04:00
bcm_sf2_regs.h net: dsa: bcm_sf2: Add VLAN registers definitions 2016-06-09 22:12:49 -07:00
bcm_sf2.c net: dsa: bcm_sf2: Add VLAN support 2016-06-09 22:12:49 -07:00
bcm_sf2.h net: dsa: bcm_sf2: Add VLAN support 2016-06-09 22:12:49 -07:00
Kconfig net: dsa: mv88e6xxx: move driver in its own folder 2016-06-25 11:29:47 -04:00
Makefile net: dsa: mv88e6xxx: move driver in its own folder 2016-06-25 11:29:47 -04:00
mv88e6060.c net: dsa: constify probed name 2016-04-17 18:54:14 -04:00
mv88e6060.h net: dsa: Keep the mii bus and address in the private structure 2016-04-13 18:15:23 -04:00