diff options
author | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2019-08-17 16:11:42 +0300 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-08-17 17:04:35 +0300 |
commit | 5bde5a4572e122a68406ddb1d0798988cf9c2b0e (patch) | |
tree | 77261fff685fba239b929baa99fd9edb796a8c4c /drivers/gpu/drm/i915/gt/uc | |
parent | 9559c8751385ba2d9ff7fc1150694b4130f8a6d9 (diff) | |
download | linux-5bde5a4572e122a68406ddb1d0798988cf9c2b0e.tar.xz |
drm/i915/uc: Cleanup fw fetch only if it was successful
We can rely on firmware status AVAILABLE to determine if any
firmware cleanup is required. Also don't unconditionally reset
fw status to SELECTED as we will loose MISSING/ERROR codes.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190817131144.26884-2-michal.wajdeczko@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/gt/uc')
-rw-r--r-- | drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c index 890ae6b4a3d0..527de1fd9d78 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c @@ -559,18 +559,16 @@ void intel_uc_fw_fini(struct intel_uc_fw *uc_fw) /** * intel_uc_fw_cleanup_fetch - cleanup uC firmware - * * @uc_fw: uC firmware * * Cleans up uC firmware by releasing the firmware GEM obj. */ void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw) { - struct drm_i915_gem_object *obj; + if (!intel_uc_fw_is_available(uc_fw)) + return; - obj = fetch_and_zero(&uc_fw->obj); - if (obj) - i915_gem_object_put(obj); + i915_gem_object_put(fetch_and_zero(&uc_fw->obj)); intel_uc_fw_change_status(uc_fw, INTEL_UC_FIRMWARE_SELECTED); } |