Re: [PATCH] drm/xe: use resource_size() in xe_pagemap_create()
From: Rodrigo Vivi
Date: Thu Oct 01 2026 - 16:44:29 EST
On Thu, Oct 01, 2026 at 10:03:22PM +0530, Aryan Sinha wrote:
> The open coded res->end - res->start + 1 is what resource_size() does.
nit: we should use imperative telling the change and why. this is just the why...
>
> Signed-off-by: Aryan Sinha <sinha.aryan03@xxxxxxxxx>
> ---
> drivers/gpu/drm/xe/xe_svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index b228a737c..e6ab5a5b3 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -1848,7 +1848,7 @@ static struct xe_pagemap *xe_pagemap_create(struct xe_device *xe, struct xe_vram
> out_no_pages:
> drm_pagemap_release_owner(&xpagemap->peer);
> out_no_owner:
> - devm_release_mem_region(dev, res->start, res->end - res->start + 1);
I noticed we are not including the linux/ioport.h here.
We should do this explicit. I know, we should had done it already when using the
struct resource. But now it makes more important. Please add it.
Thanks for the contribution,
Rodrigo.
> + devm_release_mem_region(dev, res->start, resource_size(res));
> out_err:
> drm_pagemap_put(dpagemap);
> return ERR_PTR(err);
> --
> 2.46.0
>