From: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v3 1/7] drm/xe: Simplify function return using drmm_add_action_or_reset()
Date: Fri, 12 Apr 2024 13:32:39 +0530 [thread overview]
Message-ID: <20240412080245.1044902-2-himal.prasad.ghimiray@intel.com> (raw)
In-Reply-To: <20240412080245.1044902-1-himal.prasad.ghimiray@intel.com>
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>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
drivers/gpu/drm/xe/display/xe_display.c | 8 +-------
drivers/gpu/drm/xe/xe_device.c | 6 +-----
drivers/gpu/drm/xe/xe_gsc_proxy.c | 7 +------
drivers/gpu/drm/xe/xe_gt.c | 6 +-----
drivers/gpu/drm/xe/xe_guc_pc.c | 6 +-----
drivers/gpu/drm/xe/xe_hw_engine.c | 6 +-----
6 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index 6ec375c1c4b6..63b27fbcdaca 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -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)
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index d85a2ba0a057..57a8e5c145c3 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -655,11 +655,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);
diff --git a/drivers/gpu/drm/xe/xe_gsc_proxy.c b/drivers/gpu/drm/xe/xe_gsc_proxy.c
index 35e397b68dfc..1b908d238bd1 100644
--- a/drivers/gpu/drm/xe/xe_gsc_proxy.c
+++ b/drivers/gpu/drm/xe/xe_gsc_proxy.c
@@ -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);
}
/**
diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index cfa5da900461..2421a8d34324 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -560,11 +560,7 @@ int xe_gt_init(struct xe_gt *gt)
if (err)
return err;
- err = drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt);
- if (err)
- return err;
-
- return 0;
+ return drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt);
}
static int do_gt_reset(struct xe_gt *gt)
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 521ae24f2314..509649d0e65e 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -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);
}
diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
index a688bb2d96ce..455f375c1cbd 100644
--- a/drivers/gpu/drm/xe/xe_hw_engine.c
+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
@@ -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);
--
2.25.1
next prev parent reply other threads:[~2024-04-12 7:49 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 8:02 [PATCH 0/4] Cleanup and fixes in drmm_add_action_or_reset usage Himal Prasad Ghimiray
2024-04-12 8:02 ` Himal Prasad Ghimiray [this message]
2024-04-12 12:52 ` [PATCH v3 1/7] drm/xe: Simplify function return using drmm_add_action_or_reset() Lucas De Marchi
2024-04-12 14:54 ` Ghimiray, Himal Prasad
2024-04-12 8:02 ` [PATCH v3 2/7] drm/xe: Incase of action add failure, remove sysfs only once Himal Prasad Ghimiray
2024-04-12 13:09 ` Lucas De Marchi
2024-04-12 13:13 ` Lucas De Marchi
2024-04-12 14:41 ` Jani Nikula
2024-04-12 14:55 ` Ghimiray, Himal Prasad
2024-04-12 8:02 ` [PATCH v3 3/7] drm/xe: Incase of action add failure, free_gsc_pkt " Himal Prasad Ghimiray
2024-04-12 13:14 ` Lucas De Marchi
2024-04-12 15:38 ` Ghimiray, Himal Prasad
2024-04-12 8:02 ` [PATCH v3 4/7] drm/xe: Return NULL incase of drmm_add_action_or_reset failure Himal Prasad Ghimiray
2024-04-12 8:02 ` [PATCH v3 5/7] drm/xe/gt: Abort driver load for sysfs creation failure Himal Prasad Ghimiray
2024-04-12 13:30 ` Lucas De Marchi
2024-04-12 15:38 ` Ghimiray, Himal Prasad
2024-04-12 8:02 ` [PATCH v3 6/7] drm/xe/tile: " Himal Prasad Ghimiray
2024-04-12 13:32 ` Lucas De Marchi
2024-04-12 15:39 ` Ghimiray, Himal Prasad
2024-04-12 8:02 ` [PATCH v3 7/7] drm/xe/pm: Capture errors and handle them Himal Prasad Ghimiray
2024-04-12 13:42 ` Lucas De Marchi
2024-04-12 16:31 ` Ghimiray, Himal Prasad
2024-04-12 16:58 ` Lucas De Marchi
2024-04-12 17:07 ` Ghimiray, Himal Prasad
2024-04-12 8:15 ` ✓ CI.Patch_applied: success for Cleanup and fixes in drmm_add_action_or_reset usage (rev3) Patchwork
2024-04-12 8:15 ` ✓ CI.checkpatch: " Patchwork
2024-04-12 8:17 ` ✓ CI.KUnit: " Patchwork
2024-04-12 8:31 ` ✓ CI.Build: " Patchwork
2024-04-12 8:34 ` ✓ CI.Hooks: " Patchwork
2024-04-12 8:35 ` ✓ CI.checksparse: " Patchwork
2024-04-12 8:58 ` ✓ CI.BAT: " Patchwork
2024-04-12 12:13 ` ✗ CI.FULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240412080245.1044902-2-himal.prasad.ghimiray@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox