[PATCH] drm/i915: add check for valid init_clock_gating-pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 6067aa (drm/i915: split clock gating init into per-chipset
functions) unconditionally calls the newly created
init_clock_gating-pointer. There is one case, however, where it does
not get set:

if (HAS_PCH_SPLIT(dev)) {
	...
	} else
		dev_priv->display.update_wm = NULL;
}

This can lead to a NULL-pointer exception as in
https://bugzilla.kernel.org/show_bug.cgi?id=37252

Fix it by checking if the pointer is valid before using it.

Signed-off-by: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
Cc: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
Cc: Keith Packard <keithp@xxxxxxxxxx>
---

Compile tested only, due to no hardware. I was going through the list of
regressions and had my take on this one. Exploring new subsystems here,
so hopefully it's the right direction. The other solution would be
initializing the pointer to a default value, but that one I don't know.

 drivers/gpu/drm/i915/intel_display.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 81a9059..cf75856 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7511,7 +7511,8 @@ void intel_init_clock_gating(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	dev_priv->display.init_clock_gating(dev);
+	if (dev_priv->display.init_clock_gating)
+		dev_priv->display.init_clock_gating(dev);
 
 	if (dev_priv->display.init_pch_clock_gating)
 		dev_priv->display.init_pch_clock_gating(dev);
-- 
1.7.2.5

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux