Commit 3d77d2ac authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

drm: renesas: shmobile: Use drmm_universal_plane_alloc()

According to the comments for drm_universal_plane_init(), the plane
structure should not be allocated with devm_kzalloc().

Fix lifetime issues by using drmm_universal_plane_alloc() instead.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/65ebf0513e2836227a9636e922f51c668bd69720.1694767209.git.geert+renesas@glider.be
parent 33505f77
...@@ -179,7 +179,6 @@ static int shmob_drm_plane_disable(struct drm_plane *plane, ...@@ -179,7 +179,6 @@ static int shmob_drm_plane_disable(struct drm_plane *plane,
static const struct drm_plane_funcs shmob_drm_plane_funcs = { static const struct drm_plane_funcs shmob_drm_plane_funcs = {
.update_plane = shmob_drm_plane_update, .update_plane = shmob_drm_plane_update,
.disable_plane = shmob_drm_plane_disable, .disable_plane = shmob_drm_plane_disable,
.destroy = drm_plane_cleanup,
}; };
static const uint32_t formats[] = { static const uint32_t formats[] = {
...@@ -198,19 +197,16 @@ static const uint32_t formats[] = { ...@@ -198,19 +197,16 @@ static const uint32_t formats[] = {
int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index) int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index)
{ {
struct shmob_drm_plane *splane; struct shmob_drm_plane *splane;
int ret;
splane = devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL); splane = drmm_universal_plane_alloc(sdev->ddev, struct shmob_drm_plane,
if (splane == NULL) plane, 1, &shmob_drm_plane_funcs,
return -ENOMEM; formats, ARRAY_SIZE(formats), NULL,
DRM_PLANE_TYPE_OVERLAY, NULL);
if (IS_ERR(splane))
return PTR_ERR(splane);
splane->index = index; splane->index = index;
splane->alpha = 255; splane->alpha = 255;
ret = drm_universal_plane_init(sdev->ddev, &splane->plane, 1, return 0;
&shmob_drm_plane_funcs,
formats, ARRAY_SIZE(formats), NULL,
DRM_PLANE_TYPE_OVERLAY, NULL);
return ret;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment