Skip to content

Commit 5a73dd6

Browse files
hghimiralucasdemarchi
authored andcommitted
drm/xe: Simplify function return using drmm_add_action_or_reset()
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 <[email protected]> Cc: Lucas De Marchi <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Signed-off-by: Himal Prasad Ghimiray <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent cba22c9 commit 5a73dd6

File tree

6 files changed

+6
-33
lines changed

6 files changed

+6
-33
lines changed

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,14 @@ static void display_destroy(struct drm_device *dev, void *dummy)
101101
*/
102102
int xe_display_create(struct xe_device *xe)
103103
{
104-
int err;
105-
106104
spin_lock_init(&xe->display.fb_tracking.lock);
107105

108106
xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
109107

110108
drmm_mutex_init(&xe->drm, &xe->sb_lock);
111109
xe->enabled_irq_mask = ~0;
112110

113-
err = drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
114-
if (err)
115-
return err;
116-
117-
return 0;
111+
return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
118112
}
119113

120114
static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)

drivers/gpu/drm/xe/xe_device.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,7 @@ int xe_device_probe(struct xe_device *xe)
649649

650650
xe_hwmon_register(xe);
651651

652-
err = drmm_add_action_or_reset(&xe->drm, xe_device_sanitize, xe);
653-
if (err)
654-
return err;
655-
656-
return 0;
652+
return drmm_add_action_or_reset(&xe->drm, xe_device_sanitize, xe);
657653

658654
err_fini_display:
659655
xe_display_driver_remove(xe);

drivers/gpu/drm/xe/xe_gsc_proxy.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ static int proxy_channel_alloc(struct xe_gsc *gsc)
403403
struct xe_device *xe = gt_to_xe(gt);
404404
struct xe_bo *bo;
405405
void *csme;
406-
int err;
407406

408407
csme = kzalloc(GSC_PROXY_CHANNEL_SIZE, GFP_KERNEL);
409408
if (!csme)
@@ -424,11 +423,7 @@ static int proxy_channel_alloc(struct xe_gsc *gsc)
424423
gsc->proxy.to_csme = csme;
425424
gsc->proxy.from_csme = csme + GSC_PROXY_BUFFER_SIZE;
426425

427-
err = drmm_add_action_or_reset(&xe->drm, proxy_channel_free, gsc);
428-
if (err)
429-
return err;
430-
431-
return 0;
426+
return drmm_add_action_or_reset(&xe->drm, proxy_channel_free, gsc);
432427
}
433428

434429
/**

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,7 @@ int xe_gt_init(struct xe_gt *gt)
558558
if (err)
559559
return err;
560560

561-
err = drmm_add_action_or_reset(&gt_to_xe(gt)->drm, gt_fini, gt);
562-
if (err)
563-
return err;
564-
565-
return 0;
561+
return drmm_add_action_or_reset(&gt_to_xe(gt)->drm, gt_fini, gt);
566562
}
567563

568564
static int do_gt_reset(struct xe_gt *gt)

drivers/gpu/drm/xe/xe_guc_pc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,5 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
937937

938938
pc->bo = bo;
939939

940-
err = drmm_add_action_or_reset(&xe->drm, xe_guc_pc_fini, pc);
941-
if (err)
942-
return err;
943-
944-
return 0;
940+
return drmm_add_action_or_reset(&xe->drm, xe_guc_pc_fini, pc);
945941
}

drivers/gpu/drm/xe/xe_hw_engine.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,7 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,
550550
if (xe->info.has_usm && hwe->class == XE_ENGINE_CLASS_COPY)
551551
gt->usm.reserved_bcs_instance = hwe->instance;
552552

553-
err = drmm_add_action_or_reset(&xe->drm, hw_engine_fini, hwe);
554-
if (err)
555-
return err;
556-
557-
return 0;
553+
return drmm_add_action_or_reset(&xe->drm, hw_engine_fini, hwe);
558554

559555
err_kernel_lrc:
560556
xe_lrc_finish(&hwe->kernel_lrc);

0 commit comments

Comments
 (0)