All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
@ 2014-02-19 18:07 Julien Grall
  2014-03-11 15:09 ` Julien Grall
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Julien Grall @ 2014-02-19 18:07 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, Julien Grall, tim, ian.campbell

The memory mapping is leaking when the serial driver failed to retrieve
the IRQ. We can safely move the call to ioremap after.

Also use ioremap_cache instead of ioremap_attr in some serial drivers.

Signed-off-by: Julien Grall <julien.grall@linaro.org>

---

Ian, I have dropped your ack because the patch fundamentaly changed.

    Changes in v2:
        - s/ioremap_attr/ioremap_nocache
        - Move ioremap call after retrieve the IRQ
---
 xen/drivers/char/exynos4210-uart.c |   13 +++++++------
 xen/drivers/char/omap-uart.c       |   15 ++++++++-------
 xen/drivers/char/pl011.c           |   15 +++++++--------
 3 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/xen/drivers/char/exynos4210-uart.c b/xen/drivers/char/exynos4210-uart.c
index 0619575..150d49b 100644
--- a/xen/drivers/char/exynos4210-uart.c
+++ b/xen/drivers/char/exynos4210-uart.c
@@ -334,12 +334,6 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,
         return res;
     }
 
-    uart->regs = ioremap_nocache(addr, size);
-    if ( !uart->regs )
-    {
-        early_printk("exynos4210: Unable to map the UART memory\n");
-        return -ENOMEM;
-    }
     res = dt_device_get_irq(dev, 0, &uart->irq);
     if ( res )
     {
@@ -347,6 +341,13 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,
         return res;
     }
 
+    uart->regs = ioremap_nocache(addr, size);
+    if ( !uart->regs )
+    {
+        early_printk("exynos4210: Unable to map the UART memory\n");
+        return -ENOMEM;
+    }
+
     uart->vuart.base_addr = addr;
     uart->vuart.size = size;
     uart->vuart.data_off = UTXH;
diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
index c1580ef..b29f610 100644
--- a/xen/drivers/char/omap-uart.c
+++ b/xen/drivers/char/omap-uart.c
@@ -326,13 +326,6 @@ static int __init omap_uart_init(struct dt_device_node *dev,
         return res;
     }
 
-    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
-    if ( !uart->regs )
-    {
-        early_printk("omap-uart: Unable to map the UART memory\n");
-        return -ENOMEM;
-    }
-
     res = dt_device_get_irq(dev, 0, &uart->irq);
     if ( res )
     {
@@ -340,6 +333,14 @@ static int __init omap_uart_init(struct dt_device_node *dev,
         return res;
     }
 
+    uart->regs = ioremap_nocache(addr, size);
+    if ( !uart->regs )
+    {
+        early_printk("omap-uart: Unable to map the UART memory\n");
+        return -ENOMEM;
+    }
+
+
     uart->vuart.base_addr = addr;
     uart->vuart.size = size;
     uart->vuart.data_off = UART_THR;
diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
index fd82511..fe99af6 100644
--- a/xen/drivers/char/pl011.c
+++ b/xen/drivers/char/pl011.c
@@ -248,14 +248,6 @@ static int __init pl011_uart_init(struct dt_device_node *dev,
         return res;
     }
 
-    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
-    if ( !uart->regs )
-    {
-        early_printk("pl011: Unable to map the UART memory\n");
-
-        return -ENOMEM;
-    }
-
     res = dt_device_get_irq(dev, 0, &uart->irq);
     if ( res )
     {
@@ -263,6 +255,13 @@ static int __init pl011_uart_init(struct dt_device_node *dev,
         return res;
     }
 
+    uart->regs = ioremap_nocache(addr, size);
+    if ( !uart->regs )
+    {
+        early_printk("pl011: Unable to map the UART memory\n");
+        return -ENOMEM;
+    }
+
     uart->vuart.base_addr = addr;
     uart->vuart.size = size;
     uart->vuart.data_off = DR;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-02-19 18:07 [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed Julien Grall
@ 2014-03-11 15:09 ` Julien Grall
  2014-03-11 16:13   ` Jan Beulich
  2014-03-21 12:27 ` Julien Grall
  2014-03-21 14:14 ` Ian Campbell
  2 siblings, 1 reply; 8+ messages in thread
From: Julien Grall @ 2014-03-11 15:09 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, tim, ian.campbell

Ping?

On 02/19/2014 06:07 PM, Julien Grall wrote:
> The memory mapping is leaking when the serial driver failed to retrieve
> the IRQ. We can safely move the call to ioremap after.
> 
> Also use ioremap_cache instead of ioremap_attr in some serial drivers.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> ---
> 
> Ian, I have dropped your ack because the patch fundamentaly changed.
> 
>     Changes in v2:
>         - s/ioremap_attr/ioremap_nocache
>         - Move ioremap call after retrieve the IRQ
> ---
>  xen/drivers/char/exynos4210-uart.c |   13 +++++++------
>  xen/drivers/char/omap-uart.c       |   15 ++++++++-------
>  xen/drivers/char/pl011.c           |   15 +++++++--------
>  3 files changed, 22 insertions(+), 21 deletions(-)
> 
> diff --git a/xen/drivers/char/exynos4210-uart.c b/xen/drivers/char/exynos4210-uart.c
> index 0619575..150d49b 100644
> --- a/xen/drivers/char/exynos4210-uart.c
> +++ b/xen/drivers/char/exynos4210-uart.c
> @@ -334,12 +334,6 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> -    uart->regs = ioremap_nocache(addr, size);
> -    if ( !uart->regs )
> -    {
> -        early_printk("exynos4210: Unable to map the UART memory\n");
> -        return -ENOMEM;
> -    }
>      res = dt_device_get_irq(dev, 0, &uart->irq);
>      if ( res )
>      {
> @@ -347,6 +341,13 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> +    uart->regs = ioremap_nocache(addr, size);
> +    if ( !uart->regs )
> +    {
> +        early_printk("exynos4210: Unable to map the UART memory\n");
> +        return -ENOMEM;
> +    }
> +
>      uart->vuart.base_addr = addr;
>      uart->vuart.size = size;
>      uart->vuart.data_off = UTXH;
> diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
> index c1580ef..b29f610 100644
> --- a/xen/drivers/char/omap-uart.c
> +++ b/xen/drivers/char/omap-uart.c
> @@ -326,13 +326,6 @@ static int __init omap_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> -    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
> -    if ( !uart->regs )
> -    {
> -        early_printk("omap-uart: Unable to map the UART memory\n");
> -        return -ENOMEM;
> -    }
> -
>      res = dt_device_get_irq(dev, 0, &uart->irq);
>      if ( res )
>      {
> @@ -340,6 +333,14 @@ static int __init omap_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> +    uart->regs = ioremap_nocache(addr, size);
> +    if ( !uart->regs )
> +    {
> +        early_printk("omap-uart: Unable to map the UART memory\n");
> +        return -ENOMEM;
> +    }
> +
> +
>      uart->vuart.base_addr = addr;
>      uart->vuart.size = size;
>      uart->vuart.data_off = UART_THR;
> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
> index fd82511..fe99af6 100644
> --- a/xen/drivers/char/pl011.c
> +++ b/xen/drivers/char/pl011.c
> @@ -248,14 +248,6 @@ static int __init pl011_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> -    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
> -    if ( !uart->regs )
> -    {
> -        early_printk("pl011: Unable to map the UART memory\n");
> -
> -        return -ENOMEM;
> -    }
> -
>      res = dt_device_get_irq(dev, 0, &uart->irq);
>      if ( res )
>      {
> @@ -263,6 +255,13 @@ static int __init pl011_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> +    uart->regs = ioremap_nocache(addr, size);
> +    if ( !uart->regs )
> +    {
> +        early_printk("pl011: Unable to map the UART memory\n");
> +        return -ENOMEM;
> +    }
> +
>      uart->vuart.base_addr = addr;
>      uart->vuart.size = size;
>      uart->vuart.data_off = DR;
> 


-- 
Julien Grall

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-03-11 15:09 ` Julien Grall
@ 2014-03-11 16:13   ` Jan Beulich
  2014-03-11 16:28     ` Julien Grall
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2014-03-11 16:13 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, stefano.stabellini, ian.campbell, tim

>>> On 11.03.14 at 16:09, Julien Grall <julien.grall@linaro.org> wrote:
> Ping?

I'm afraid this will lead no-where if you don't include Keir on at least
the Cc list. (Of course these are all ARM-only drivers, so getting an
ARM maintainer's ack or an ARM maintainer to commit this might also
be acceptable, by slightly bending the policy.)

Jan

> On 02/19/2014 06:07 PM, Julien Grall wrote:
>> The memory mapping is leaking when the serial driver failed to retrieve
>> the IRQ. We can safely move the call to ioremap after.
>> 
>> Also use ioremap_cache instead of ioremap_attr in some serial drivers.
>> 
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> 
>> ---
>> 
>> Ian, I have dropped your ack because the patch fundamentaly changed.
>> 
>>     Changes in v2:
>>         - s/ioremap_attr/ioremap_nocache
>>         - Move ioremap call after retrieve the IRQ
>> ---
>>  xen/drivers/char/exynos4210-uart.c |   13 +++++++------
>>  xen/drivers/char/omap-uart.c       |   15 ++++++++-------
>>  xen/drivers/char/pl011.c           |   15 +++++++--------
>>  3 files changed, 22 insertions(+), 21 deletions(-)
>> 
>> diff --git a/xen/drivers/char/exynos4210-uart.c 
> b/xen/drivers/char/exynos4210-uart.c
>> index 0619575..150d49b 100644
>> --- a/xen/drivers/char/exynos4210-uart.c
>> +++ b/xen/drivers/char/exynos4210-uart.c
>> @@ -334,12 +334,6 @@ static int __init exynos4210_uart_init(struct 
> dt_device_node *dev,
>>          return res;
>>      }
>>  
>> -    uart->regs = ioremap_nocache(addr, size);
>> -    if ( !uart->regs )
>> -    {
>> -        early_printk("exynos4210: Unable to map the UART memory\n");
>> -        return -ENOMEM;
>> -    }
>>      res = dt_device_get_irq(dev, 0, &uart->irq);
>>      if ( res )
>>      {
>> @@ -347,6 +341,13 @@ static int __init exynos4210_uart_init(struct 
> dt_device_node *dev,
>>          return res;
>>      }
>>  
>> +    uart->regs = ioremap_nocache(addr, size);
>> +    if ( !uart->regs )
>> +    {
>> +        early_printk("exynos4210: Unable to map the UART memory\n");
>> +        return -ENOMEM;
>> +    }
>> +
>>      uart->vuart.base_addr = addr;
>>      uart->vuart.size = size;
>>      uart->vuart.data_off = UTXH;
>> diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
>> index c1580ef..b29f610 100644
>> --- a/xen/drivers/char/omap-uart.c
>> +++ b/xen/drivers/char/omap-uart.c
>> @@ -326,13 +326,6 @@ static int __init omap_uart_init(struct dt_device_node 
> *dev,
>>          return res;
>>      }
>>  
>> -    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
>> -    if ( !uart->regs )
>> -    {
>> -        early_printk("omap-uart: Unable to map the UART memory\n");
>> -        return -ENOMEM;
>> -    }
>> -
>>      res = dt_device_get_irq(dev, 0, &uart->irq);
>>      if ( res )
>>      {
>> @@ -340,6 +333,14 @@ static int __init omap_uart_init(struct dt_device_node 
> *dev,
>>          return res;
>>      }
>>  
>> +    uart->regs = ioremap_nocache(addr, size);
>> +    if ( !uart->regs )
>> +    {
>> +        early_printk("omap-uart: Unable to map the UART memory\n");
>> +        return -ENOMEM;
>> +    }
>> +
>> +
>>      uart->vuart.base_addr = addr;
>>      uart->vuart.size = size;
>>      uart->vuart.data_off = UART_THR;
>> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
>> index fd82511..fe99af6 100644
>> --- a/xen/drivers/char/pl011.c
>> +++ b/xen/drivers/char/pl011.c
>> @@ -248,14 +248,6 @@ static int __init pl011_uart_init(struct dt_device_node 
> *dev,
>>          return res;
>>      }
>>  
>> -    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
>> -    if ( !uart->regs )
>> -    {
>> -        early_printk("pl011: Unable to map the UART memory\n");
>> -
>> -        return -ENOMEM;
>> -    }
>> -
>>      res = dt_device_get_irq(dev, 0, &uart->irq);
>>      if ( res )
>>      {
>> @@ -263,6 +255,13 @@ static int __init pl011_uart_init(struct dt_device_node 
> *dev,
>>          return res;
>>      }
>>  
>> +    uart->regs = ioremap_nocache(addr, size);
>> +    if ( !uart->regs )
>> +    {
>> +        early_printk("pl011: Unable to map the UART memory\n");
>> +        return -ENOMEM;
>> +    }
>> +
>>      uart->vuart.base_addr = addr;
>>      uart->vuart.size = size;
>>      uart->vuart.data_off = DR;
>> 
> 
> 
> -- 
> Julien Grall
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org 
> http://lists.xen.org/xen-devel 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-03-11 16:13   ` Jan Beulich
@ 2014-03-11 16:28     ` Julien Grall
  2014-03-11 16:37       ` Jan Beulich
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Grall @ 2014-03-11 16:28 UTC (permalink / raw)
  To: Jan Beulich
  Cc: xen-devel, Keir (Xen.org), stefano.stabellini, ian.campbell, tim

On 03/11/2014 04:13 PM, Jan Beulich wrote:
>>>> On 11.03.14 at 16:09, Julien Grall <julien.grall@linaro.org> wrote:
>> Ping?
> 
> I'm afraid this will lead no-where if you don't include Keir on at least
> the Cc list. (Of course these are all ARM-only drivers, so getting an
> ARM maintainer's ack or an ARM maintainer to commit this might also
> be acceptable, by slightly bending the policy.)

Hmmm ... right (adding Keir). I have noticed that every changes on
ARM-only drivers were not acked by Keir.

I'm wondering if we can move ARM-only serial drivers under ARM
maintainer section.

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-03-11 16:28     ` Julien Grall
@ 2014-03-11 16:37       ` Jan Beulich
  2014-03-12  9:51         ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2014-03-11 16:37 UTC (permalink / raw)
  To: Julien Grall
  Cc: xen-devel, Keir (Xen.org), stefano.stabellini, ian.campbell, tim

>>> On 11.03.14 at 17:28, Julien Grall <julien.grall@linaro.org> wrote:
> On 03/11/2014 04:13 PM, Jan Beulich wrote:
>>>>> On 11.03.14 at 16:09, Julien Grall <julien.grall@linaro.org> wrote:
>>> Ping?
>> 
>> I'm afraid this will lead no-where if you don't include Keir on at least
>> the Cc list. (Of course these are all ARM-only drivers, so getting an
>> ARM maintainer's ack or an ARM maintainer to commit this might also
>> be acceptable, by slightly bending the policy.)
> 
> Hmmm ... right (adding Keir). I have noticed that every changes on
> ARM-only drivers were not acked by Keir.
> 
> I'm wondering if we can move ARM-only serial drivers under ARM
> maintainer section.

I wouldn't mind.

Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-03-11 16:37       ` Jan Beulich
@ 2014-03-12  9:51         ` Ian Campbell
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2014-03-12  9:51 UTC (permalink / raw)
  To: Jan Beulich
  Cc: xen-devel, Keir (Xen.org), Julien Grall, stefano.stabellini, tim

On Tue, 2014-03-11 at 16:37 +0000, Jan Beulich wrote:
> >>> On 11.03.14 at 17:28, Julien Grall <julien.grall@linaro.org> wrote:
> > On 03/11/2014 04:13 PM, Jan Beulich wrote:
> >>>>> On 11.03.14 at 16:09, Julien Grall <julien.grall@linaro.org> wrote:
> >>> Ping?
> >> 
> >> I'm afraid this will lead no-where if you don't include Keir on at least
> >> the Cc list. (Of course these are all ARM-only drivers, so getting an
> >> ARM maintainer's ack or an ARM maintainer to commit this might also
> >> be acceptable, by slightly bending the policy.)
> > 
> > Hmmm ... right (adding Keir). I have noticed that every changes on
> > ARM-only drivers were not acked by Keir.
> > 
> > I'm wondering if we can move ARM-only serial drivers under ARM
> > maintainer section.
> 
> I wouldn't mind.

It makes sense to me too. Julien, can you make patch to MAINTAINERS
please. Don't forget to CC Keir that one last time ;-)

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-02-19 18:07 [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed Julien Grall
  2014-03-11 15:09 ` Julien Grall
@ 2014-03-21 12:27 ` Julien Grall
  2014-03-21 14:14 ` Ian Campbell
  2 siblings, 0 replies; 8+ messages in thread
From: Julien Grall @ 2014-03-21 12:27 UTC (permalink / raw)
  To: Julien Grall
  Cc: xen-devel, Keir (Xen.org), tim, ian.campbell, stefano.stabellini

Ian, Keir: Ping?

On 02/19/2014 06:07 PM, Julien Grall wrote:
> The memory mapping is leaking when the serial driver failed to retrieve
> the IRQ. We can safely move the call to ioremap after.
> 
> Also use ioremap_cache instead of ioremap_attr in some serial drivers.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> ---
> 
> Ian, I have dropped your ack because the patch fundamentaly changed.
> 
>     Changes in v2:
>         - s/ioremap_attr/ioremap_nocache
>         - Move ioremap call after retrieve the IRQ
> ---
>  xen/drivers/char/exynos4210-uart.c |   13 +++++++------
>  xen/drivers/char/omap-uart.c       |   15 ++++++++-------
>  xen/drivers/char/pl011.c           |   15 +++++++--------
>  3 files changed, 22 insertions(+), 21 deletions(-)
> 
> diff --git a/xen/drivers/char/exynos4210-uart.c b/xen/drivers/char/exynos4210-uart.c
> index 0619575..150d49b 100644
> --- a/xen/drivers/char/exynos4210-uart.c
> +++ b/xen/drivers/char/exynos4210-uart.c
> @@ -334,12 +334,6 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> -    uart->regs = ioremap_nocache(addr, size);
> -    if ( !uart->regs )
> -    {
> -        early_printk("exynos4210: Unable to map the UART memory\n");
> -        return -ENOMEM;
> -    }
>      res = dt_device_get_irq(dev, 0, &uart->irq);
>      if ( res )
>      {
> @@ -347,6 +341,13 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> +    uart->regs = ioremap_nocache(addr, size);
> +    if ( !uart->regs )
> +    {
> +        early_printk("exynos4210: Unable to map the UART memory\n");
> +        return -ENOMEM;
> +    }
> +
>      uart->vuart.base_addr = addr;
>      uart->vuart.size = size;
>      uart->vuart.data_off = UTXH;
> diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
> index c1580ef..b29f610 100644
> --- a/xen/drivers/char/omap-uart.c
> +++ b/xen/drivers/char/omap-uart.c
> @@ -326,13 +326,6 @@ static int __init omap_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> -    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
> -    if ( !uart->regs )
> -    {
> -        early_printk("omap-uart: Unable to map the UART memory\n");
> -        return -ENOMEM;
> -    }
> -
>      res = dt_device_get_irq(dev, 0, &uart->irq);
>      if ( res )
>      {
> @@ -340,6 +333,14 @@ static int __init omap_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> +    uart->regs = ioremap_nocache(addr, size);
> +    if ( !uart->regs )
> +    {
> +        early_printk("omap-uart: Unable to map the UART memory\n");
> +        return -ENOMEM;
> +    }
> +
> +
>      uart->vuart.base_addr = addr;
>      uart->vuart.size = size;
>      uart->vuart.data_off = UART_THR;
> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
> index fd82511..fe99af6 100644
> --- a/xen/drivers/char/pl011.c
> +++ b/xen/drivers/char/pl011.c
> @@ -248,14 +248,6 @@ static int __init pl011_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> -    uart->regs = ioremap_attr(addr, size, PAGE_HYPERVISOR_NOCACHE);
> -    if ( !uart->regs )
> -    {
> -        early_printk("pl011: Unable to map the UART memory\n");
> -
> -        return -ENOMEM;
> -    }
> -
>      res = dt_device_get_irq(dev, 0, &uart->irq);
>      if ( res )
>      {
> @@ -263,6 +255,13 @@ static int __init pl011_uart_init(struct dt_device_node *dev,
>          return res;
>      }
>  
> +    uart->regs = ioremap_nocache(addr, size);
> +    if ( !uart->regs )
> +    {
> +        early_printk("pl011: Unable to map the UART memory\n");
> +        return -ENOMEM;
> +    }
> +
>      uart->vuart.base_addr = addr;
>      uart->vuart.size = size;
>      uart->vuart.data_off = DR;
> 


-- 
Julien Grall

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
  2014-02-19 18:07 [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed Julien Grall
  2014-03-11 15:09 ` Julien Grall
  2014-03-21 12:27 ` Julien Grall
@ 2014-03-21 14:14 ` Ian Campbell
  2 siblings, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2014-03-21 14:14 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, stefano.stabellini, tim

On Wed, 2014-02-19 at 18:07 +0000, Julien Grall wrote:
> The memory mapping is leaking when the serial driver failed to retrieve

"leaked"

> the IRQ. We can safely move the call to ioremap after.
> 
> Also use ioremap_cache instead of ioremap_attr in some serial drivers.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> ---
> 
> Ian, I have dropped your ack because the patch fundamentaly changed.

Apart from the grammar nit you can reinstate it now, I've rereviewed.

You didn't CC Keir BTW.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-21 14:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-19 18:07 [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed Julien Grall
2014-03-11 15:09 ` Julien Grall
2014-03-11 16:13   ` Jan Beulich
2014-03-11 16:28     ` Julien Grall
2014-03-11 16:37       ` Jan Beulich
2014-03-12  9:51         ` Ian Campbell
2014-03-21 12:27 ` Julien Grall
2014-03-21 14:14 ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.