diff options
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 16 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 1 |
2 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 61fdef8eac49..907d20ef6d4d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
| @@ -138,7 +138,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev, | |||
| 138 | { | 138 | { |
| 139 | struct nouveau_framebuffer *nouveau_fb; | 139 | struct nouveau_framebuffer *nouveau_fb; |
| 140 | struct drm_gem_object *gem; | 140 | struct drm_gem_object *gem; |
| 141 | int ret; | 141 | int ret = -ENOMEM; |
| 142 | 142 | ||
| 143 | gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); | 143 | gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); |
| 144 | if (!gem) | 144 | if (!gem) |
| @@ -146,15 +146,19 @@ nouveau_user_framebuffer_create(struct drm_device *dev, | |||
| 146 | 146 | ||
| 147 | nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL); | 147 | nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL); |
| 148 | if (!nouveau_fb) | 148 | if (!nouveau_fb) |
| 149 | return ERR_PTR(-ENOMEM); | 149 | goto err_unref; |
| 150 | 150 | ||
| 151 | ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem)); | 151 | ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem)); |
| 152 | if (ret) { | 152 | if (ret) |
| 153 | drm_gem_object_unreference(gem); | 153 | goto err; |
| 154 | return ERR_PTR(ret); | ||
| 155 | } | ||
| 156 | 154 | ||
| 157 | return &nouveau_fb->base; | 155 | return &nouveau_fb->base; |
| 156 | |||
| 157 | err: | ||
| 158 | kfree(nouveau_fb); | ||
| 159 | err_unref: | ||
| 160 | drm_gem_object_unreference(gem); | ||
| 161 | return ERR_PTR(ret); | ||
| 158 | } | 162 | } |
| 159 | 163 | ||
| 160 | static const struct drm_mode_config_funcs nouveau_mode_config_funcs = { | 164 | static const struct drm_mode_config_funcs nouveau_mode_config_funcs = { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 9352010030e9..4c1bc061fae2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
| @@ -385,6 +385,7 @@ out_unlock: | |||
| 385 | mutex_unlock(&dev->struct_mutex); | 385 | mutex_unlock(&dev->struct_mutex); |
| 386 | if (chan) | 386 | if (chan) |
| 387 | nouveau_bo_vma_del(nvbo, &fbcon->nouveau_fb.vma); | 387 | nouveau_bo_vma_del(nvbo, &fbcon->nouveau_fb.vma); |
| 388 | nouveau_bo_unmap(nvbo); | ||
| 388 | out_unpin: | 389 | out_unpin: |
| 389 | nouveau_bo_unpin(nvbo); | 390 | nouveau_bo_unpin(nvbo); |
| 390 | out_unref: | 391 | out_unref: |
