Commit 757b90bb authored by Luca Coelho's avatar Luca Coelho Committed by Jouni Högander
Browse files

drm/i915/display: pre-initialize some values in probe_gmdid_display()



When intel_display_device_probe() (and, subsequently,
probe_gmdid_display()) returns, the caller expects ver, rel and step
to be initialized.  Since there's no way to check that there was a
failure and no_display was returned without some further refactoring,
pre-initiliaze all these values to zero to keep it simple and safe.

Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Reviewed-by: default avatarSuraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: default avatarJouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230601090338.80284-1-luciano.coelho@intel.com
parent 2aa01e4d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -800,6 +800,15 @@ probe_gmdid_display(struct drm_i915_private *i915, u16 *ver, u16 *rel, u16 *step
	u32 val;
	int i;

	/* The caller expects to ver, rel and step to be initialized
	 * here, and there's no good way to check when there was a
	 * failure and no_display was returned.  So initialize all these
	 * values here zero, to be sure.
	 */
	*ver = 0;
	*rel = 0;
	*step = 0;

	addr = pci_iomap_range(pdev, 0, i915_mmio_reg_offset(GMD_ID_DISPLAY), sizeof(u32));
	if (!addr) {
		drm_err(&i915->drm, "Cannot map MMIO BAR to read display GMD_ID\n");