1
0
Fork 0
alistair23-linux/arch/arm/plat-orion
Arnd Bergmann 8337d08350 ARM: orion: fix orion_ge00_switch_board_info initialization
A section type mismatch warning shows up when building with LTO,
since orion_ge00_mvmdio_bus_name was put in __initconst but not marked
const itself:

include/linux/of.h: In function 'spear_setup_of_timer':
arch/arm/mach-spear/time.c:207:34: error: 'timer_of_match' causes a section type conflict with 'orion_ge00_mvmdio_bus_name'
 static const struct of_device_id timer_of_match[] __initconst = {
                                  ^
arch/arm/plat-orion/common.c:475:32: note: 'orion_ge00_mvmdio_bus_name' was declared here
 static __initconst const char *orion_ge00_mvmdio_bus_name = "orion-mii";
                                ^

As pointed out by Andrew Lunn, it should in fact be 'const' but not
'__initconst' because the string is never copied but may be accessed
after the init sections are freed. To fix that, I get rid of the
extra symbol and rewrite the initialization in a simpler way that
assigns both the bus_id and modalias statically.

I spotted another theoretical bug in the same place, where d->netdev[i]
may be an out of bounds access, this can be fixed by moving the device
assignment into the loop.

Cc: stable@vger.kernel.org
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-02-22 17:48:39 +01:00
..
include/plat ARM: orion: Register DSA switch as a MDIO device 2017-02-07 10:51:47 -05:00
Makefile Removal of GENERIC_GPIO for v3.10 2013-05-09 09:59:16 -07:00
common.c ARM: orion: fix orion_ge00_switch_board_info initialization 2018-02-22 17:48:39 +01:00
gpio.c ARM/orion/gpio: Replace three seq_printf() calls by seq_puts() in orion_gpio_dbg_show() 2016-10-17 17:40:24 +02:00
irq.c ARM: orion: always use MULTI_IRQ_HANDLER 2015-12-07 18:16:42 +01:00
mpp.c ARM: orion: always use MULTI_IRQ_HANDLER 2015-12-07 18:16:42 +01:00
pcie.c arm: plat-orion: use mv_mbus_dram_info() in PCIe code 2013-03-17 18:03:44 +00:00
time.c ARM: orion: implement ARM delay timer 2016-01-26 23:45:05 +00:00