summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/shmobile/shmob_drm_plane.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-04-25 12:12:33 +0200
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-06-20 10:07:14 +0200
commit16ad3b2ce8dd5840c7661990476c3693569dab5a (patch)
tree0b42d67878932b8d9188fdae08e95f0ed5b31e59 /drivers/gpu/drm/shmobile/shmob_drm_plane.c
parent2e7c9b351dee0c89e78c9a0432f71738a0ecc287 (diff)
drm/shmobile: Use devm_* managed functions
This simplifies cleanup paths and fixes a probe time crash in the error path when trying to cleanup mode setting before it was initialized. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/shmobile/shmob_drm_plane.c')
-rw-r--r--drivers/gpu/drm/shmobile/shmob_drm_plane.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
index 22b1d45d82d3..060ae03e5f9b 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_plane.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_plane.c
@@ -221,11 +221,8 @@ static int shmob_drm_plane_disable(struct drm_plane *plane)
static void shmob_drm_plane_destroy(struct drm_plane *plane)
{
- struct shmob_drm_plane *splane = to_shmob_plane(plane);
-
shmob_drm_plane_disable(plane);
drm_plane_cleanup(plane);
- kfree(splane);
}
static const struct drm_plane_funcs shmob_drm_plane_funcs = {
@@ -251,7 +248,7 @@ int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index)
struct shmob_drm_plane *splane;
int ret;
- splane = kzalloc(sizeof(*splane), GFP_KERNEL);
+ splane = devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL);
if (splane == NULL)
return -ENOMEM;
@@ -261,8 +258,6 @@ int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index)
ret = drm_plane_init(sdev->ddev, &splane->plane, 1,
&shmob_drm_plane_funcs, formats,
ARRAY_SIZE(formats), false);
- if (ret < 0)
- kfree(splane);
return ret;
}