Re: [PATCH 2/4 v2] firmware: stratix10-svc: Unmap some previously memremap'ed memory
From: Greg KH
Date: Tue May 05 2020 - 10:44:00 EST
On Wed, Apr 29, 2020 at 08:52:43AM +0200, Christophe JAILLET wrote:
> In 'svc_create_memory_pool()' we memremap some memory. This has to be
> undone in case of error and if the driver is removed.
>
> The easiest way to do it is to use 'devm_memremap()'.
>
> Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> ---
> drivers/firmware/stratix10-svc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
> index 3a176e62754a..de5870f76c5e 100644
> --- a/drivers/firmware/stratix10-svc.c
> +++ b/drivers/firmware/stratix10-svc.c
> @@ -631,7 +631,7 @@ svc_create_memory_pool(struct platform_device *pdev,
> end = rounddown(sh_memory->addr + sh_memory->size, PAGE_SIZE);
> paddr = begin;
> size = end - begin;
> - va = memremap(paddr, size, MEMREMAP_WC);
> + va = devm_memremap(dev, paddr, size, MEMREMAP_WC);
> if (!va) {
> dev_err(dev, "fail to remap shared memory\n");
> return ERR_PTR(-EINVAL);
And there was no previous unmap happening when the pool was torn down
that now needs to be removed?
thanks,
greg k-h