* [PATCH 1/3] ARM: clps711x: mark clps711x_compat as const
@ 2018-02-20 16:24 Arnd Bergmann
2018-02-20 16:24 ` [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name " Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Arnd Bergmann @ 2018-02-20 16:24 UTC (permalink / raw)
To: linux-arm-kernel
The array of string pointers is put in __initconst, and the strings themselves
are marke 'const' but the the pointers are not, which caused a warning when
built with LTO:
arch/arm/mach-clps711x/board-dt.c:72:20: error: 'clps711x_compat' causes a section type conflict with 'feroceon_ids'
static const char *clps711x_compat[] __initconst = {
This marks the array itself const as well, which was certainly the
intention originally.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mach-clps711x/board-dt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-clps711x/board-dt.c b/arch/arm/mach-clps711x/board-dt.c
index ee1f83b1a332..4c89a8e9a2e3 100644
--- a/arch/arm/mach-clps711x/board-dt.c
+++ b/arch/arm/mach-clps711x/board-dt.c
@@ -69,7 +69,7 @@ static void clps711x_restart(enum reboot_mode mode, const char *cmd)
soft_restart(0);
}
-static const char *clps711x_compat[] __initconst = {
+static const char *const clps711x_compat[] __initconst = {
"cirrus,ep7209",
NULL
};
--
2.9.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name as const
2018-02-20 16:24 [PATCH 1/3] ARM: clps711x: mark clps711x_compat as const Arnd Bergmann
@ 2018-02-20 16:24 ` Arnd Bergmann
2018-02-21 3:49 ` Andrew Lunn
2018-02-20 16:24 ` [PATCH 3/3] ARM: davinci: mark spi_board_info arrays " Arnd Bergmann
2018-02-22 16:43 ` [PATCH 1/3] ARM: clps711x: mark clps711x_compat " Arnd Bergmann
2 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2018-02-20 16:24 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/plat-orion/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index aff6994950ba..4e1d8270537c 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -472,7 +472,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
/*****************************************************************************
* Ethernet switch
****************************************************************************/
-static __initconst const char *orion_ge00_mvmdio_bus_name = "orion-mii";
+static __initconst const char *const orion_ge00_mvmdio_bus_name = "orion-mii";
static __initdata struct mdio_board_info
orion_ge00_switch_board_info;
--
2.9.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] ARM: davinci: mark spi_board_info arrays as const
2018-02-20 16:24 [PATCH 1/3] ARM: clps711x: mark clps711x_compat as const Arnd Bergmann
2018-02-20 16:24 ` [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name " Arnd Bergmann
@ 2018-02-20 16:24 ` Arnd Bergmann
2018-02-22 16:43 ` Arnd Bergmann
2018-02-22 16:43 ` [PATCH 1/3] ARM: clps711x: mark clps711x_compat " Arnd Bergmann
2 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2018-02-20 16:24 UTC (permalink / raw)
To: linux-arm-kernel
Building with LTO revealed that three spi_board_info arrays are marked
__initconst, but not const:
arch/arm/mach-davinci/board-dm365-evm.c: In function 'dm365_evm_init':
arch/arm/mach-davinci/board-dm365-evm.c:729:30: error: 'dm365_evm_spi_info' causes a section type conflict with 'dm646x_edma_device'
static struct spi_board_info dm365_evm_spi_info[] __initconst = {
^
arch/arm/mach-davinci/dm646x.c:603:42: note: 'dm646x_edma_device' was declared here
static const struct platform_device_info dm646x_edma_device __initconst = {
This marks them const as well, as was originally intended.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index e457f299cd44..d6b11907380c 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -368,7 +368,7 @@ static struct spi_eeprom at25640a = {
.flags = EE_ADDR2,
};
-static struct spi_board_info dm355_evm_spi_info[] __initconst = {
+static const struct spi_board_info dm355_evm_spi_info[] __initconst = {
{
.modalias = "at25",
.platform_data = &at25640a,
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index be997243447b..fad9a5611a5d 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -217,7 +217,7 @@ static struct spi_eeprom at25640a = {
.flags = EE_ADDR2,
};
-static struct spi_board_info dm355_leopard_spi_info[] __initconst = {
+static const struct spi_board_info dm355_leopard_spi_info[] __initconst = {
{
.modalias = "at25",
.platform_data = &at25640a,
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index e75741fb2c1d..e3780986d2a3 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -726,7 +726,7 @@ static struct spi_eeprom at25640 = {
.flags = EE_ADDR2,
};
-static struct spi_board_info dm365_evm_spi_info[] __initconst = {
+static const struct spi_board_info dm365_evm_spi_info[] __initconst = {
{
.modalias = "at25",
.platform_data = &at25640,
--
2.9.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name as const
2018-02-20 16:24 ` [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name " Arnd Bergmann
@ 2018-02-21 3:49 ` Andrew Lunn
2018-02-21 11:34 ` Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2018-02-21 3:49 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name as const
2018-02-21 3:49 ` Andrew Lunn
@ 2018-02-21 11:34 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2018-02-21 11:34 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Feb 21, 2018 at 4:49 AM, Andrew Lunn <andrew@lunn.ch> wrote:
> 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.
I looked at it some more and agree with your analysis, thanks for your
review!
I also checked the only other user of mdiobus_register_board_info(),
and made sure it does not have this problem.
I've prepared a new patch now, will send that after some more testing.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] ARM: clps711x: mark clps711x_compat as const
2018-02-20 16:24 [PATCH 1/3] ARM: clps711x: mark clps711x_compat as const Arnd Bergmann
2018-02-20 16:24 ` [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name " Arnd Bergmann
2018-02-20 16:24 ` [PATCH 3/3] ARM: davinci: mark spi_board_info arrays " Arnd Bergmann
@ 2018-02-22 16:43 ` Arnd Bergmann
2 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2018-02-22 16:43 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 20, 2018 at 5:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> The array of string pointers is put in __initconst, and the strings themselves
> are marke 'const' but the the pointers are not, which caused a warning when
> built with LTO:
>
> arch/arm/mach-clps711x/board-dt.c:72:20: error: 'clps711x_compat' causes a section type conflict with 'feroceon_ids'
> static const char *clps711x_compat[] __initconst = {
>
> This marks the array itself const as well, which was certainly the
> intention originally.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied to the fixes branch now.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] ARM: davinci: mark spi_board_info arrays as const
2018-02-20 16:24 ` [PATCH 3/3] ARM: davinci: mark spi_board_info arrays " Arnd Bergmann
@ 2018-02-22 16:43 ` Arnd Bergmann
2018-02-23 10:00 ` Sekhar Nori
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2018-02-22 16:43 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 20, 2018 at 5:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> Building with LTO revealed that three spi_board_info arrays are marked
> __initconst, but not const:
>
> arch/arm/mach-davinci/board-dm365-evm.c: In function 'dm365_evm_init':
> arch/arm/mach-davinci/board-dm365-evm.c:729:30: error: 'dm365_evm_spi_info' causes a section type conflict with 'dm646x_edma_device'
> static struct spi_board_info dm365_evm_spi_info[] __initconst = {
> ^
> arch/arm/mach-davinci/dm646x.c:603:42: note: 'dm646x_edma_device' was declared here
> static const struct platform_device_info dm646x_edma_device __initconst = {
>
> This marks them const as well, as was originally intended.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I applied this to the fixes branch now.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] ARM: davinci: mark spi_board_info arrays as const
2018-02-22 16:43 ` Arnd Bergmann
@ 2018-02-23 10:00 ` Sekhar Nori
0 siblings, 0 replies; 8+ messages in thread
From: Sekhar Nori @ 2018-02-23 10:00 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 22 February 2018 10:13 PM, Arnd Bergmann wrote:
> On Tue, Feb 20, 2018 at 5:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> Building with LTO revealed that three spi_board_info arrays are marked
>> __initconst, but not const:
>>
>> arch/arm/mach-davinci/board-dm365-evm.c: In function 'dm365_evm_init':
>> arch/arm/mach-davinci/board-dm365-evm.c:729:30: error: 'dm365_evm_spi_info' causes a section type conflict with 'dm646x_edma_device'
>> static struct spi_board_info dm365_evm_spi_info[] __initconst = {
>> ^
>> arch/arm/mach-davinci/dm646x.c:603:42: note: 'dm646x_edma_device' was declared here
>> static const struct platform_device_info dm646x_edma_device __initconst = {
>>
>> This marks them const as well, as was originally intended.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> I applied this to the fixes branch now.
Thanks Arnd. FWIW now:
Acked-by: Sekhar Nori <nsekhar@ti.com>
Regards,
Sekhar
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-02-23 10:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20 16:24 [PATCH 1/3] ARM: clps711x: mark clps711x_compat as const Arnd Bergmann
2018-02-20 16:24 ` [PATCH 2/3] ARM: orion: mark orion_ge00_mvmdio_bus_name " Arnd Bergmann
2018-02-21 3:49 ` Andrew Lunn
2018-02-21 11:34 ` Arnd Bergmann
2018-02-20 16:24 ` [PATCH 3/3] ARM: davinci: mark spi_board_info arrays " Arnd Bergmann
2018-02-22 16:43 ` Arnd Bergmann
2018-02-23 10:00 ` Sekhar Nori
2018-02-22 16:43 ` [PATCH 1/3] ARM: clps711x: mark clps711x_compat " Arnd Bergmann
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).