Skip to content

Commit 3d77d2a

Browse files
committed
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: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/65ebf0513e2836227a9636e922f51c668bd69720.1694767209.git.geert+renesas@glider.be
1 parent 33505f7 commit 3d77d2a

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ static int shmob_drm_plane_disable(struct drm_plane *plane,
179179
static const struct drm_plane_funcs shmob_drm_plane_funcs = {
180180
.update_plane = shmob_drm_plane_update,
181181
.disable_plane = shmob_drm_plane_disable,
182-
.destroy = drm_plane_cleanup,
183182
};
184183

185184
static const uint32_t formats[] = {
@@ -198,19 +197,16 @@ static const uint32_t formats[] = {
198197
int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index)
199198
{
200199
struct shmob_drm_plane *splane;
201-
int ret;
202200

203-
splane = devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL);
204-
if (splane == NULL)
205-
return -ENOMEM;
201+
splane = drmm_universal_plane_alloc(sdev->ddev, struct shmob_drm_plane,
202+
plane, 1, &shmob_drm_plane_funcs,
203+
formats, ARRAY_SIZE(formats), NULL,
204+
DRM_PLANE_TYPE_OVERLAY, NULL);
205+
if (IS_ERR(splane))
206+
return PTR_ERR(splane);
206207

207208
splane->index = index;
208209
splane->alpha = 255;
209210

210-
ret = drm_universal_plane_init(sdev->ddev, &splane->plane, 1,
211-
&shmob_drm_plane_funcs,
212-
formats, ARRAY_SIZE(formats), NULL,
213-
DRM_PLANE_TYPE_OVERLAY, NULL);
214-
215-
return ret;
211+
return 0;
216212
}

0 commit comments

Comments
 (0)