diff mbox

[5/7] sna/cursor: add an assert on cursor->image

Message ID 1455294689-29249-6-git-send-email-martin.peres@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Peres Feb. 12, 2016, 4:31 p.m. UTC
Caught by Klockwork, but it was a false positive. However, better safe
than sorry.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
---
 src/sna/sna_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chris Wilson Feb. 12, 2016, 4:47 p.m. UTC | #1
On Fri, Feb 12, 2016 at 06:31:27PM +0200, Martin Peres wrote:
> Caught by Klockwork, but it was a false positive. However, better safe
> than sorry.

No. cursor->image can be NULL for old gen/kernels.
-Chris
diff mbox

Patch

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 9215b23..78937c2 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -5573,8 +5573,9 @@  static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
 	argb = get_cursor_argb(sna->cursor.ref);
 	pitch = BitmapBytePad(width);
 
+	assert(cursor->image);
 	image = cursor->image;
-	if (image == NULL || transformed) {
+	if (transformed) {
 		image = sna->cursor.scratch;
 		cursor->last_width = cursor->last_height = size;
 	}