[PATCH 1/3] drm/xe: Return error if drm_buddy_init() fails
Matt Roper
matthew.d.roper at intel.com
Fri Dec 15 00:11:37 UTC 2023
On Thu, Dec 14, 2023 at 01:39:52PM -0800, Lucas De Marchi wrote:
> Fix warning:
> ../drivers/gpu/drm/xe/xe_ttm_vram_mgr.c: In function ‘__xe_ttm_vram_mgr_init’:
> ../drivers/gpu/drm/xe/xe_ttm_vram_mgr.c:340:13: error: variable ‘err’ set but not used [-Werror=unused-but-set-variable]
> 340 | int err;
> | ^~~
>
> Check for the error return and return it, like done by other drivers.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Seems like err used to be checked, but the check went missing in commit
033851c948f2 ("drm/xe: Implement stolen memory.").
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> index 953e5dc0fd80..115ec745e502 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> @@ -348,6 +348,8 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr,
>
> ttm_resource_manager_init(man, &xe->ttm, size);
> err = drm_buddy_init(&mgr->mm, man->size, default_page_size);
> + if (err)
> + return err;
>
> ttm_set_driver_manager(&xe->ttm, mem_type, &mgr->manager);
> ttm_resource_manager_set_used(&mgr->manager, true);
> --
> 2.40.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list