drm/i915: Do kunmap if renderstate parsing fails
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Fri, 17 Jul 2015 16:08:51 +0000 (17:08 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 21 Jul 2015 07:25:48 +0000 (09:25 +0200)
Kunmap the renderstate page on error path.

Reviewed-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_render_state.c

index a0201fc94d256431b41aa5ca26dbef0fae565257..b6492fe3722b56a180ea53b1cfecba7edf9fcb46 100644 (file)
@@ -96,8 +96,10 @@ static int render_state_setup(struct render_state *so)
                        s = lower_32_bits(r);
                        if (so->gen >= 8) {
                                if (i + 1 >= rodata->batch_items ||
-                                   rodata->batch[i + 1] != 0)
-                                       return -EINVAL;
+                                   rodata->batch[i + 1] != 0) {
+                                       ret = -EINVAL;
+                                       goto err_out;
+                               }
 
                                d[i++] = s;
                                s = upper_32_bits(r);
@@ -120,6 +122,10 @@ static int render_state_setup(struct render_state *so)
        }
 
        return 0;
+
+err_out:
+       kunmap(page);
+       return ret;
 }
 
 void i915_gem_render_state_fini(struct render_state *so)