Skip to content

Commit

Permalink
drm/exynos: add error check routine in exynos_drm_open
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
YoungJun Cho authored and Inki Dae committed Jul 4, 2013
1 parent 782953e commit ba3706c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/gpu/drm/exynos/exynos_drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,21 @@ static int exynos_drm_unload(struct drm_device *dev)
static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
{
struct drm_exynos_file_private *file_priv;
int ret;

file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
if (!file_priv)
return -ENOMEM;

file->driver_priv = file_priv;

return exynos_drm_subdrv_open(dev, file);
ret = exynos_drm_subdrv_open(dev, file);
if (ret) {
kfree(file_priv);
file->driver_priv = NULL;
}

return ret;
}

static void exynos_drm_preclose(struct drm_device *dev,
Expand Down

0 comments on commit ba3706c

Please sign in to comment.