@@ -3119,6 +3119,11 @@ static void oprom_get_vbt(struct drm_i915_private *i915,
return;
}
+static inline bool is_empty_vbt(struct intel_vbt *vbt)
+{
+ return vbt && vbt->type == I915_VBT_NONE;
+}
+
/**
* intel_bios_init - find VBT and initialize settings from the BIOS
* @i915: i915 device instance
@@ -3154,19 +3159,19 @@ void intel_bios_init(struct drm_i915_private *i915)
intel_load_vbt_firmware(i915, vbt);
- if (!vbt->vbt && opregion->asls)
+ if (is_empty_vbt(vbt) && opregion->asls)
intel_load_opregion_vbt(i915, opregion, vbt);
/*
* If the OpRegion does not have VBT, look in SPI flash through MMIO or
* PCI mapping
*/
- if (!vbt->vbt && IS_DGFX(i915))
+ if (is_empty_vbt(vbt) && IS_DGFX(i915))
spi_oprom_get_vbt(i915, vbt);
- if (!vbt->vbt)
+ if (is_empty_vbt(vbt))
oprom_get_vbt(i915, vbt);
- if (!vbt->vbt)
+ if (is_empty_vbt(vbt))
goto out;
header = (struct vbt_header *)vbt->vbt;
We depend on a non null vbt field in intel_vbt to determine if a vbt is read from its source. This may not be foolproof hence rely on vbt->type to determine if vbt is read from a source. Note that this does not determine the validity of read vbt. Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com> --- drivers/gpu/drm/i915/display/intel_bios.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)