summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJouni Högander <jouni.hogander@intel.com>2023-12-03 13:48:39 +0200
committerJouni Högander <jouni.hogander@intel.com>2023-12-04 07:26:29 +0200
commitae424921a5ca763fef4be46f900065db0b0870ae (patch)
treee4e912f72369610485ccc69e49dbfadd1003268a
parent6383f69bd2ccd4765b22d60f12576891daa36c1a (diff)
drm/i915/display: Handle invalid fb_modifier in intel_fb_modifier_to_tiling
Lookup_modifier is returning INTEL_PLANE_CAP_TILING_4 on invalid fb_modifier value. Use lookup_modifier_or_null in intel_fb_modifier_to_tiling and return I915_TILING_NONE in case lookup_modifier_or_null returns null. Signed-off-by: Jouni Högander <jouni.hogander@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231203114840.841311-4-jouni.hogander@intel.com
-rw-r--r--drivers/gpu/drm/i915/display/intel_fb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index f42a693f96c1..20d58a021a42 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -303,7 +303,14 @@ lookup_format_info(const struct drm_format_info formats[],
unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier)
{
- u8 tiling_caps = lookup_modifier(fb_modifier)->plane_caps &
+ const struct intel_modifier_desc *md;
+ u8 tiling_caps;
+
+ md = lookup_modifier_or_null(fb_modifier);
+ if (!md)
+ return I915_TILING_NONE;
+
+ tiling_caps = lookup_modifier_or_null(fb_modifier)->plane_caps &
INTEL_PLANE_CAP_TILING_MASK;
switch (tiling_caps) {