From: Julien Grall <julien.grall@linaro.org>
To: Julien Grall <julien.grall@linaro.org>
Cc: xen-devel@lists.xenproject.org, "Keir (Xen.org)" <keir@xen.org>,
tim@xen.org, ian.campbell@citrix.com,
stefano.stabellini@citrix.com
Subject: Re: [PATCH v2] xen/serial: Don't leak memory mapping if the serial initialization has failed
Date: Fri, 21 Mar 2014 12:27:34 +0000 [thread overview]
Message-ID: <532C3036.9070408@linaro.org> (raw)
In-Reply-To: <1392833230-28706-1-git-send-email-julien.grall@linaro.org>
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
next prev parent reply other threads:[~2014-03-21 12:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2014-03-21 14:14 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532C3036.9070408@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.