Patchwork [3/3] ARM: imx: mm-imx3: Free l2x0_base

login
register
mail settings
Submitter Fabio Estevam
Date July 8, 2013, 5:58 p.m.
Message ID <1373306318-15604-3-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/257583/
State New
Headers show

Comments

Fabio Estevam - July 8, 2013, 5:58 p.m.
From: Fabio Estevam <fabio.estevam@freescale.com>

After l2x0_base has been used, we should free it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-imx/mm-imx3.c | 1 +
 1 file changed, 1 insertion(+)
Shawn Guo - July 9, 2013, 6:24 a.m.
On Mon, Jul 08, 2013 at 02:58:38PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> After l2x0_base has been used, we should free it.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-imx/mm-imx3.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
> index 0884ca9..3143f5e 100644
> --- a/arch/arm/mach-imx/mm-imx3.c
> +++ b/arch/arm/mach-imx/mm-imx3.c
> @@ -113,6 +113,7 @@ static void __init imx3_init_l2x0(void)
>  	}
>  
>  	l2x0_init(l2x0_base, 0x00030024, 0x00000000);
> +	iounmap(l2x0_base);

Are you sure?  I think cache-l2x0 driver still needs the mapping after
that.

Shawn

>  #endif
>  }
>  
> -- 
> 1.8.1.2
>
Fabio Estevam - July 9, 2013, 6:16 p.m.
On Tue, Jul 9, 2013 at 3:24 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Mon, Jul 08, 2013 at 02:58:38PM -0300, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@freescale.com>
>>
>> After l2x0_base has been used, we should free it.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>> ---
>>  arch/arm/mach-imx/mm-imx3.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
>> index 0884ca9..3143f5e 100644
>> --- a/arch/arm/mach-imx/mm-imx3.c
>> +++ b/arch/arm/mach-imx/mm-imx3.c
>> @@ -113,6 +113,7 @@ static void __init imx3_init_l2x0(void)
>>       }
>>
>>       l2x0_init(l2x0_base, 0x00030024, 0x00000000);
>> +     iounmap(l2x0_base);
>
> Are you sure?  I think cache-l2x0 driver still needs the mapping after
> that.

l2x0_base is a local variable of the static imx3_init_l2x0() function,
so we should iounmap it.
Sascha Hauer - July 9, 2013, 6:20 p.m.
On Tue, Jul 09, 2013 at 03:16:00PM -0300, Fabio Estevam wrote:
> On Tue, Jul 9, 2013 at 3:24 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > On Mon, Jul 08, 2013 at 02:58:38PM -0300, Fabio Estevam wrote:
> >> From: Fabio Estevam <fabio.estevam@freescale.com>
> >>
> >> After l2x0_base has been used, we should free it.
> >>
> >> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> >> ---
> >>  arch/arm/mach-imx/mm-imx3.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
> >> index 0884ca9..3143f5e 100644
> >> --- a/arch/arm/mach-imx/mm-imx3.c
> >> +++ b/arch/arm/mach-imx/mm-imx3.c
> >> @@ -113,6 +113,7 @@ static void __init imx3_init_l2x0(void)
> >>       }
> >>
> >>       l2x0_init(l2x0_base, 0x00030024, 0x00000000);
> >> +     iounmap(l2x0_base);
> >
> > Are you sure?  I think cache-l2x0 driver still needs the mapping after
> > that.
> 
> l2x0_base is a local variable of the static imx3_init_l2x0() function,
> so we should iounmap it.

l2x0_base is passed to l2x0_init which uses it for the outer cache
maintenance operations. I wonder this doesn't crash your kernel.

Sascha

Patch

diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 0884ca9..3143f5e 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -113,6 +113,7 @@  static void __init imx3_init_l2x0(void)
 	}
 
 	l2x0_init(l2x0_base, 0x00030024, 0x00000000);
+	iounmap(l2x0_base);
 #endif
 }