diff --git a/shared-core/nouveau_irq.c b/shared-core/nouveau_irq.c
index 2a3d8a0..b84aa5e 100644
--- a/shared-core/nouveau_irq.c
+++ b/shared-core/nouveau_irq.c
@@ -205,6 +205,12 @@ nouveau_graph_chid_from_grctx(struct drm_device *dev)
 	else
 		inst = NV_READ(0x40032c) & 0xfffff;
 
+	if (!inst) {
+		DRM_ERROR("PGRAPH instance is zero, probably caused a spurious interrupt.\n");
+		DRM_ERROR("A single occurance before allocating the first FIFO is not considered very harmful.\n");
+		return -1;
+	}
+
 	for (i = 0; i < dev_priv->Engine.fifo.channels; i++) {
 		struct nouveau_channel *chan = dev_priv->fifos[i];
 
@@ -220,6 +226,10 @@ nouveau_graph_chid_from_grctx(struct drm_device *dev)
 		}
 	}
 
+	/* No channel found, return -1 so we don't access memory out of bound. */
+	if (i == dev_priv->Engine.fifo.channels)
+		return -1;
+
 	return i;
 }
 
@@ -227,7 +237,6 @@ static int
 nouveau_graph_trapped_channel(struct drm_device *dev, int *channel_ret)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
-	struct nouveau_engine *engine = &dev_priv->Engine;
 	int channel;
 
 	if (dev_priv->card_type < NV_10)
@@ -238,8 +247,14 @@ nouveau_graph_trapped_channel(struct drm_device *dev, int *channel_ret)
 	else
 		channel = nouveau_graph_chid_from_grctx(dev);
 
-	if (channel >= engine->fifo.channels || !dev_priv->fifos[channel]) {
-		DRM_ERROR("AIII, invalid/inactive channel id %d\n", channel);
+	if (channel == -1) {
+		DRM_ERROR("PGRAPH interrupt from unknown channel.\n");
+		return -EINVAL;
+	}
+
+	/* channel will never exceed 127. */
+	if (!dev_priv->fifos[channel]) {
+		DRM_ERROR("PGRAPH interrupt from inactive channel id %d\n", channel);
 		return -EINVAL;
 	}
 
