diff options
author | Inki Dae <inki.dae@samsung.com> | 2012-12-07 04:06:43 -0500 |
---|---|---|
committer | Inki Dae <daeinki@gmail.com> | 2012-12-13 09:05:45 -0500 |
commit | 662aa6d7632cab054277bafda67d13d9a8a81929 (patch) | |
tree | 167fcd7e71f2636f9eecfeedad6c225d3042e650 | |
parent | db7e55ae527ccbca300eb5b15f5428b83325328d (diff) |
drm/exynos: add exception codes to exynos_drm_fbdev_create()
This patch releases allocated resources correctly.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index a2232792e0c0..885ef235d59c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
@@ -164,7 +164,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
164 | exynos_gem_obj = exynos_drm_gem_create(dev, 0, size); | 164 | exynos_gem_obj = exynos_drm_gem_create(dev, 0, size); |
165 | if (IS_ERR(exynos_gem_obj)) { | 165 | if (IS_ERR(exynos_gem_obj)) { |
166 | ret = PTR_ERR(exynos_gem_obj); | 166 | ret = PTR_ERR(exynos_gem_obj); |
167 | goto out; | 167 | goto err_release_framebuffer; |
168 | } | 168 | } |
169 | 169 | ||
170 | exynos_fbdev->exynos_gem_obj = exynos_gem_obj; | 170 | exynos_fbdev->exynos_gem_obj = exynos_gem_obj; |
@@ -174,7 +174,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
174 | if (IS_ERR_OR_NULL(helper->fb)) { | 174 | if (IS_ERR_OR_NULL(helper->fb)) { |
175 | DRM_ERROR("failed to create drm framebuffer.\n"); | 175 | DRM_ERROR("failed to create drm framebuffer.\n"); |
176 | ret = PTR_ERR(helper->fb); | 176 | ret = PTR_ERR(helper->fb); |
177 | goto out; | 177 | goto err_destroy_gem; |
178 | } | 178 | } |
179 | 179 | ||
180 | helper->fbdev = fbi; | 180 | helper->fbdev = fbi; |
@@ -186,14 +186,24 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
186 | ret = fb_alloc_cmap(&fbi->cmap, 256, 0); | 186 | ret = fb_alloc_cmap(&fbi->cmap, 256, 0); |
187 | if (ret) { | 187 | if (ret) { |
188 | DRM_ERROR("failed to allocate cmap.\n"); | 188 | DRM_ERROR("failed to allocate cmap.\n"); |
189 | goto out; | 189 | goto err_destroy_framebuffer; |
190 | } | 190 | } |
191 | 191 | ||
192 | ret = exynos_drm_fbdev_update(helper, helper->fb); | 192 | ret = exynos_drm_fbdev_update(helper, helper->fb); |
193 | if (ret < 0) { | 193 | if (ret < 0) |
194 | fb_dealloc_cmap(&fbi->cmap); | 194 | goto err_dealloc_cmap; |
195 | goto out; | 195 | |
196 | } | 196 | mutex_unlock(&dev->struct_mutex); |
197 | return ret; | ||
198 | |||
199 | err_dealloc_cmap: | ||
200 | fb_dealloc_cmap(&fbi->cmap); | ||
201 | err_destroy_framebuffer: | ||
202 | drm_framebuffer_cleanup(helper->fb); | ||
203 | err_destroy_gem: | ||
204 | exynos_drm_gem_destroy(exynos_gem_obj); | ||
205 | err_release_framebuffer: | ||
206 | framebuffer_release(fbi); | ||
197 | 207 | ||
198 | /* | 208 | /* |
199 | * if failed, all resources allocated above would be released by | 209 | * if failed, all resources allocated above would be released by |