drm/gf100-/gr: fix -ENOSPC detection when allocating zbc table entries
authorBen Skeggs <bskeggs@redhat.com>
Tue, 12 Aug 2014 13:11:18 +0000 (23:11 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 14 Aug 2014 21:58:39 +0000 (07:58 +1000)
Spotted by Coverity.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c

index db19191176fa513ed958377fdceb1a4e6a735afd..30fd1dc64f9307603e137c43d5f6bf0e76e05d4f 100644 (file)
@@ -68,6 +68,9 @@ nvc0_graph_zbc_color_get(struct nvc0_graph_priv *priv, int format,
                }
        }
 
+       if (zbc < 0)
+               return zbc;
+
        memcpy(priv->zbc_color[zbc].ds, ds, sizeof(priv->zbc_color[zbc].ds));
        memcpy(priv->zbc_color[zbc].l2, l2, sizeof(priv->zbc_color[zbc].l2));
        priv->zbc_color[zbc].format = format;
@@ -109,6 +112,9 @@ nvc0_graph_zbc_depth_get(struct nvc0_graph_priv *priv, int format,
                }
        }
 
+       if (zbc < 0)
+               return zbc;
+
        priv->zbc_depth[zbc].format = format;
        priv->zbc_depth[zbc].ds = ds;
        priv->zbc_depth[zbc].l2 = l2;