Subject: [PATCH] ARM: S3C24XX: Fix Section mismatch

From: [email-masked] (Kukjin Kim)
Date: Wed, 07 Mar 2012 03:41:22 -0800

On 03/07/12 03:22, Russell King - ARM Linux wrote:
> On Wed, Mar 07, 2012 at 02:36:52AM -0800, Kukjin Kim wrote:
>> WARNING: arch/arm/mach-s3c24xx/built-in.o(.data+0xf44): Section mismatch in reference
>> from the variable s3c2416_irq_interface to the function .init.text:s3c2416_irq_add()
>> The variable s3c2416_irq_interface references
>> the function __init s3c2416_irq_add()
>> If the reference is valid then annotate the
>> variable with __init* or __refdata (see linux/init.h) or name the variable:
>> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
>>
>> WARNING: arch/arm/mach-s3c24xx/built-in.o(.data+0x1b80): Section mismatch in reference
>> from the variable s3c2443_irq_interface to the function .init.text:s3c2443_irq_add()
>> The variable s3c2443_irq_interface references
>> the function __init s3c2443_irq_add()
>> If the reference is valid then annotate the
>> variable with __init* or __refdata (see linux/init.h) or name the variable:
>> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
>
>> diff --git a/arch/arm/mach-s3c24xx/irq-s3c2416.c b/arch/arm/mach-s3c24xx/irq-s3c2416.c
>> index b8a5836..59b7632 100644
>> --- a/arch/arm/mach-s3c24xx/irq-s3c2416.c
>> +++ b/arch/arm/mach-s3c24xx/irq-s3c2416.c
>> @@ -310,7 +310,7 @@ static int __init s3c2416_irq_add(struct device *dev)
>>   	return 0;
>>   }
>>
>> -static struct subsys_interface s3c2416_irq_interface = {
>> +static struct subsys_interface s3c2416_irq_interface __initdata = {
>>   	.name		= "s3c2416_irq",
>>   	.subsys		=&s3c2416_subsys,
>>   	.add_dev	= s3c2416_irq_add,
>> diff --git a/arch/arm/mach-s3c24xx/irq-s3c2443.c b/arch/arm/mach-s3c24xx/irq-s3c2443.c
>> index 35e4ff2..439f186 100644
>> --- a/arch/arm/mach-s3c24xx/irq-s3c2443.c
>> +++ b/arch/arm/mach-s3c24xx/irq-s3c2443.c
>> @@ -265,7 +265,7 @@ static int __init s3c2443_irq_add(struct device *dev)
>>   	return 0;
>>   }
>>
>> -static struct subsys_interface s3c2443_irq_interface = {
>> +static struct subsys_interface s3c2443_irq_interface __initdata = {
>>   	.name		= "s3c2443_irq",
>>   	.subsys		=&s3c2443_subsys,
>>   	.add_dev	= s3c2443_irq_add,
>
> You register these structures with some other bit of code.  That other
> bit of code adds these structures to a list. You then mark them as
> __initdata, which means they get freed and the memory reused.  That
> corrupts the list beneath the other code.
>
> So, clearly, both of these are wrong.

Oops, I see. Let me check it again.
Thanks for pointing out.

Best regards,
Kgene.
--
Kukjin Kim <[email-masked]>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.