drm/xe: Use ERR_CAST to return an error-valued pointer
authorYu Jiaoliang <yujiaoliang@vivo.com>
Fri, 6 Sep 2024 07:01:09 +0000 (15:01 +0800)
committerMatthew Brost <matthew.brost@intel.com>
Thu, 12 Sep 2024 19:18:21 +0000 (12:18 -0700)
Instead of directly casting and returning an error-valued pointer,
use ERR_CAST to make the error handling more explicit and improve
code clarity.

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240906070109.1852860-1-yujiaoliang@vivo.com
drivers/gpu/drm/xe/xe_sa.c

index fe2cb2a96f7885113aac15a2c79e06fe220a070c..e055bed7ae55553e85533fdc80caecd593d52201 100644 (file)
@@ -53,7 +53,7 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
        if (IS_ERR(bo)) {
                drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
                        PTR_ERR(bo));
-               return (struct xe_sa_manager *)bo;
+               return ERR_CAST(bo);
        }
        sa_manager->bo = bo;
        sa_manager->is_iomem = bo->vmap.is_iomem;