dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: add check for valid init_clock_gating-pointer
@ 2011-06-15 22:24 Wolfram Sang
  2011-06-15 22:30 ` Jesse Barnes
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2011-06-15 22:24 UTC (permalink / raw)
  To: dri-devel; +Cc: Wolfram Sang

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@pengutronix.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Keith Packard <keithp@keithp.com>
---

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-07-02 18:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 22:24 [PATCH] drm/i915: add check for valid init_clock_gating-pointer Wolfram Sang
2011-06-15 22:30 ` Jesse Barnes
2011-06-16 13:28   ` Wolfram Sang
2011-06-16 15:15     ` Jesse Barnes
2011-06-16 15:47       ` Chris Wilson
2011-06-19 19:22         ` Wolfram Sang
2011-06-19 20:04           ` Chris Wilson
2011-06-20 16:10             ` [PATCH] drm/i915: gracefully bail out when init_clock_gating-pointer is not set Wolfram Sang
2011-06-20 16:43               ` Chris Wilson
2011-06-20 17:36                 ` [PATCH V2] " Wolfram Sang
2011-06-20 17:38                   ` Jesse Barnes
2011-07-02 15:55                     ` Wolfram Sang
2011-07-02 18:00                       ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox