[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180221034938.GE14844@lunn.ch>
Date: Wed, 21 Feb 2018 04:49:38 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Arnd Bergmann <arnd@...db.de>
Cc: arm@...nel.org, Jason Cooper <jason@...edaemon.net>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Gregory Clement <gregory.clement@...e-electrons.com>,
Russell King <linux@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name as const
On Tue, Feb 20, 2018 at 05:24:51PM +0100, Arnd Bergmann wrote:
> 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";
>
> This marks it const as well.
Hi Arnd
I'm not sure this is the correct fix. orion_ge00_mvmdio_bus_name is
assigned to orion_ge00_switch_board_info->bus_id. This is then passed
to mdiobus_register_board_info() which makes a copy of
orion_ge00_switch_board_info and adds it to its linked list. The
original orion_ge00_switch_board_info will get freed since it is
__initdata, but the copy still has a pointer to
orion_ge00_mvmdio_bus_name, which also gets freed.
I think the correct fix is to remove the __initconst from
orion_ge00_mvmdio_bus_name. Marking it const is however valid.
Andrew
Powered by blists - more mailing lists