In the case of vbt residing in opregion, we simply remap the region
into the kernel and pass the memory reference. Instead duplicate the
memory to handle a saner cleanup in intel_bios_init.
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240228213235.2495611-6-radhakrishna.sripada@intel.com
        oprom_vbt = firmware_get_vbt(i915, NULL);
        vbt = oprom_vbt;
 
-       if (!vbt)
-               vbt = intel_opregion_get_vbt(i915, NULL);
+       if (!vbt) {
+               oprom_vbt = intel_opregion_get_vbt(i915, NULL);
+               vbt = oprom_vbt;
+       }
 
        /*
         * If the OpRegion does not have VBT, look in SPI flash through MMIO or
 
        if (size)
                *size = opregion->vbt_size;
 
-       return opregion->vbt;
+       return kmemdup(opregion->vbt, opregion->vbt_size, GFP_KERNEL);
 }
 
 bool intel_opregion_headless_sku(struct drm_i915_private *i915)