Skip to content

Commit

Permalink
drm/i915/uc: Cleanup fw fetch only if it was successful
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Michal Wajdeczko authored and Chris Wilson committed Aug 17, 2019
1 parent 9559c87 commit 5bde5a4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5bde5a4

Please sign in to comment.