Skip to content

Commit 394b524

Browse files
jnikulajlahtine-intel
authored andcommitted
drm/i915/gem: fix bitwise and logical AND mixup
CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND is an int, defaulting to 250. When the wakeref is non-zero, it's either -1 or a dynamically allocated pointer, depending on CONFIG_DRM_I915_DEBUG_RUNTIME_PM. It's likely that the code works by coincidence with the bitwise AND, but with CONFIG_DRM_I915_DEBUG_RUNTIME_PM=y, there's the off chance that the condition evaluates to false, and intel_wakeref_auto() doesn't get called. Switch to the intended logical AND. v2: Use != to avoid clang -Wconstant-logical-operand (Nathan) Fixes: ad74457 ("drm/i915/dgfx: Release mmap on rpm suspend") Cc: Matthew Auld <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Anshuman Gupta <[email protected]> Cc: Andi Shyti <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: [email protected] # v6.1+ Reviewed-by: Matthew Auld <[email protected]> Reviewed-by: Andi Shyti <[email protected]> # v1 Link: https://patchwork.freedesktop.org/patch/msgid/643cc0a4d12f47fd8403d42581e83b1e9c4543c7.1726680898.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]> (cherry picked from commit 4c1bfe2) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 9852d85 commit 394b524

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/i915/gem/i915_gem_ttm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
11311131
GEM_WARN_ON(!i915_ttm_cpu_maps_iomem(bo->resource));
11321132
}
11331133

1134-
if (wakeref & CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
1134+
if (wakeref && CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND != 0)
11351135
intel_wakeref_auto(&to_i915(obj->base.dev)->runtime_pm.userfault_wakeref,
11361136
msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
11371137

0 commit comments

Comments
 (0)