drm/xe: Simplify function return using drmm_add_action_or_reset()
authorHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Fri, 12 Apr 2024 18:12:05 +0000 (23:42 +0530)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 18 Apr 2024 20:26:34 +0000 (13:26 -0700)
Instead of assigning the value of drmm_add_action_or_reset() to err and
returning err in case of failure and 0 in case of success, simply return
the result of drmm_add_action_or_reset().

-v2:
cleanup in xe_display too.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240412181211.1155732-2-himal.prasad.ghimiray@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/display/xe_display.c
drivers/gpu/drm/xe/xe_device.c
drivers/gpu/drm/xe/xe_gsc_proxy.c
drivers/gpu/drm/xe/xe_gt.c
drivers/gpu/drm/xe/xe_guc_pc.c
drivers/gpu/drm/xe/xe_hw_engine.c

index 6ec375c1c4b6c05aed07ba8432214b3de270c56e..63b27fbcdaca36baad7f7f24238ba239ca389b7f 100644 (file)
@@ -101,8 +101,6 @@ static void display_destroy(struct drm_device *dev, void *dummy)
  */
 int xe_display_create(struct xe_device *xe)
 {
-       int err;
-
        spin_lock_init(&xe->display.fb_tracking.lock);
 
        xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
@@ -110,11 +108,7 @@ int xe_display_create(struct xe_device *xe)
        drmm_mutex_init(&xe->drm, &xe->sb_lock);
        xe->enabled_irq_mask = ~0;
 
-       err = drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
-       if (err)
-               return err;
-
-       return 0;
+       return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
 }
 
 static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
index a7c4e4f73200ce206c6667ee842f3af509e03710..3b082059483664824bff58b2370d03192b7554a9 100644 (file)
@@ -649,11 +649,7 @@ int xe_device_probe(struct xe_device *xe)
 
        xe_hwmon_register(xe);
 
-       err = drmm_add_action_or_reset(&xe->drm, xe_device_sanitize, xe);
-       if (err)
-               return err;
-
-       return 0;
+       return drmm_add_action_or_reset(&xe->drm, xe_device_sanitize, xe);
 
 err_fini_display:
        xe_display_driver_remove(xe);
index 35e397b68dfcd8a9aa887240b41deb7b1a300490..1b908d238bd1a66a81efeaeddde32b91262d0264 100644 (file)
@@ -403,7 +403,6 @@ static int proxy_channel_alloc(struct xe_gsc *gsc)
        struct xe_device *xe = gt_to_xe(gt);
        struct xe_bo *bo;
        void *csme;
-       int err;
 
        csme = kzalloc(GSC_PROXY_CHANNEL_SIZE, GFP_KERNEL);
        if (!csme)
@@ -424,11 +423,7 @@ static int proxy_channel_alloc(struct xe_gsc *gsc)
        gsc->proxy.to_csme = csme;
        gsc->proxy.from_csme = csme + GSC_PROXY_BUFFER_SIZE;
 
-       err = drmm_add_action_or_reset(&xe->drm, proxy_channel_free, gsc);
-       if (err)
-               return err;
-
-       return 0;
+       return drmm_add_action_or_reset(&xe->drm, proxy_channel_free, gsc);
 }
 
 /**
index 091c0eb6ce2b69e1161660e91e78ffdc3945ba5d..10ba91fadb9a9d74c1a48dac2b024ef9edd871b2 100644 (file)
@@ -558,11 +558,7 @@ int xe_gt_init(struct xe_gt *gt)
        if (err)
                return err;
 
-       err = drmm_add_action_or_reset(&gt_to_xe(gt)->drm, gt_fini, gt);
-       if (err)
-               return err;
-
-       return 0;
+       return drmm_add_action_or_reset(&gt_to_xe(gt)->drm, gt_fini, gt);
 }
 
 static int do_gt_reset(struct xe_gt *gt)
index 521ae24f23148d5cee18748d3eaf5e370ae39ee4..509649d0e65e1c5aef5cc1518ca23335075fa4ab 100644 (file)
@@ -937,9 +937,5 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
 
        pc->bo = bo;
 
-       err = drmm_add_action_or_reset(&xe->drm, xe_guc_pc_fini, pc);
-       if (err)
-               return err;
-
-       return 0;
+       return drmm_add_action_or_reset(&xe->drm, xe_guc_pc_fini, pc);
 }
index a688bb2d96ce3a272e68901467e037f6ce5b8702..455f375c1cbd6908e9805183719bb17935dfa22d 100644 (file)
@@ -550,11 +550,7 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,
        if (xe->info.has_usm && hwe->class == XE_ENGINE_CLASS_COPY)
                gt->usm.reserved_bcs_instance = hwe->instance;
 
-       err = drmm_add_action_or_reset(&xe->drm, hw_engine_fini, hwe);
-       if (err)
-               return err;
-
-       return 0;
+       return drmm_add_action_or_reset(&xe->drm, hw_engine_fini, hwe);
 
 err_kernel_lrc:
        xe_lrc_finish(&hwe->kernel_lrc);