include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / gpu / drm / nouveau / nouveau_grctx.c
index d5d84c8..32f0e49 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/firmware.h>
+#include <linux/slab.h>
 
 #include "drmP.h"
 #include "nouveau_drv.h"
@@ -56,6 +57,9 @@ nouveau_grctx_prog_load(struct drm_device *dev)
        char name[32];
        int ret, i;
 
+       if (pgraph->accel_blocked)
+               return -ENODEV;
+
        if (!pgraph->ctxprog) {
                sprintf(name, "nouveau/nv%02x.ctxprog", chipset);
                ret = request_firmware(&fw, name, &dev->pdev->dev);
@@ -94,8 +98,8 @@ nouveau_grctx_prog_load(struct drm_device *dev)
                }
 
                pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL);
-               if (!pgraph->ctxprog) {
-                       NV_ERROR(dev, "OOM copying ctxprog\n");
+               if (!pgraph->ctxvals) {
+                       NV_ERROR(dev, "OOM copying ctxvals\n");
                        release_firmware(fw);
                        nouveau_grctx_fini(dev);
                        return -ENOMEM;