All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: dri-devel@lists.freedesktop.org
Cc: Wolfram Sang <w.sang@pengutronix.de>
Subject: [PATCH] drm/i915: add check for valid init_clock_gating-pointer
Date: Thu, 16 Jun 2011 00:24:39 +0200	[thread overview]
Message-ID: <1308176679-13766-1-git-send-email-w.sang@pengutronix.de> (raw)

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

             reply	other threads:[~2011-06-15 22:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 22:24 Wolfram Sang [this message]
2011-06-15 22:30 ` [PATCH] drm/i915: add check for valid init_clock_gating-pointer 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308176679-13766-1-git-send-email-w.sang@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.