[PATCH 02/13] drm/xe/sa: Drop redundant NULL assignments
Matthew Brost
matthew.brost at intel.com
Thu Dec 12 03:03:58 UTC 2024
On Thu, Dec 12, 2024 at 02:01:30AM +0100, Michal Wajdeczko wrote:
> The sa_manager is drmm_kzalloc'ed so all members are already zero.
> And in case of kvzalloc() failure we are not returning pointer to
> the sa_manager at all, so no point in resetting .bo member.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> ---
> drivers/gpu/drm/xe/xe_sa.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
> index 4e7aba445ebc..eb314ca75355 100644
> --- a/drivers/gpu/drm/xe/xe_sa.c
> +++ b/drivers/gpu/drm/xe/xe_sa.c
> @@ -44,8 +44,6 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
> if (!sa_manager)
> return ERR_PTR(-ENOMEM);
>
> - sa_manager->bo = NULL;
> -
> bo = xe_managed_bo_create_pin_map(xe, tile, size,
> XE_BO_FLAG_VRAM_IF_DGFX(tile) |
> XE_BO_FLAG_GGTT |
> @@ -61,10 +59,8 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
>
> if (bo->vmap.is_iomem) {
> sa_manager->cpu_ptr = kvzalloc(managed_size, GFP_KERNEL);
> - if (!sa_manager->cpu_ptr) {
> - sa_manager->bo = NULL;
> + if (!sa_manager->cpu_ptr)
> return ERR_PTR(-ENOMEM);
> - }
> } else {
> sa_manager->cpu_ptr = bo->vmap.vaddr;
> memset(sa_manager->cpu_ptr, 0, bo->ttm.base.size);
> --
> 2.47.1
>
More information about the Intel-xe
mailing list