diff options
author | YoungJun Cho <yj44.cho@samsung.com> | 2013-07-01 04:00:47 -0400 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2013-07-04 02:55:36 -0400 |
commit | ba3706c0f19ab77593b8b3be6649746ac56905d3 (patch) | |
tree | 865635af6062a9f8335ef19c1e4e85b365bc3da6 | |
parent | 782953ece3d102ccb31df87ecfeeb96064126afb (diff) |
drm/exynos: add error check routine in exynos_drm_open
When the exynos_drm_subdrv_open() returns error, the file_priv
should be released and file->driver_priv set to NULL.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 276237348d1e..ca2729a85129 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -155,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev) | |||
155 | static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) | 155 | static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) |
156 | { | 156 | { |
157 | struct drm_exynos_file_private *file_priv; | 157 | struct drm_exynos_file_private *file_priv; |
158 | int ret; | ||
158 | 159 | ||
159 | file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL); | 160 | file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL); |
160 | if (!file_priv) | 161 | if (!file_priv) |
@@ -162,7 +163,13 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) | |||
162 | 163 | ||
163 | file->driver_priv = file_priv; | 164 | file->driver_priv = file_priv; |
164 | 165 | ||
165 | return exynos_drm_subdrv_open(dev, file); | 166 | ret = exynos_drm_subdrv_open(dev, file); |
167 | if (ret) { | ||
168 | kfree(file_priv); | ||
169 | file->driver_priv = NULL; | ||
170 | } | ||
171 | |||
172 | return ret; | ||
166 | } | 173 | } |
167 | 174 | ||
168 | static void exynos_drm_preclose(struct drm_device *dev, | 175 | static void exynos_drm_preclose(struct drm_device *dev, |