summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/renesas/shmobile
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2023-09-15 11:53:34 +0300
committerGeert Uytterhoeven <geert+renesas@glider.be>2023-10-16 12:47:45 +0300
commit3d77d2ac7d9d5218a1f3df49e5bf8bd5c4f35b5a (patch)
tree7010229149e5f807e0616c53635150e80209156b /drivers/gpu/drm/renesas/shmobile
parent33505f7718186fbe74604c7217143a0845eaeb5f (diff)
downloadlinux-3d77d2ac7d9d5218a1f3df49e5bf8bd5c4f35b5a.tar.xz
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 <geert+renesas@glider.be> Link: https://lore.kernel.org/r/65ebf0513e2836227a9636e922f51c668bd69720.1694767209.git.geert+renesas@glider.be
Diffstat (limited to 'drivers/gpu/drm/renesas/shmobile')
-rw-r--r--drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
index 3a5db319bad1..1fb68b5fe915 100644
--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
+++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
@@ -179,7 +179,6 @@ static int shmob_drm_plane_disable(struct drm_plane *plane,
static const struct drm_plane_funcs shmob_drm_plane_funcs = {
.update_plane = shmob_drm_plane_update,
.disable_plane = shmob_drm_plane_disable,
- .destroy = drm_plane_cleanup,
};
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)
{
struct shmob_drm_plane *splane;
- int ret;
- splane = devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL);
- if (splane == NULL)
- return -ENOMEM;
+ splane = drmm_universal_plane_alloc(sdev->ddev, struct shmob_drm_plane,
+ plane, 1, &shmob_drm_plane_funcs,
+ formats, ARRAY_SIZE(formats), NULL,
+ DRM_PLANE_TYPE_OVERLAY, NULL);
+ if (IS_ERR(splane))
+ return PTR_ERR(splane);
splane->index = index;
splane->alpha = 255;
- ret = drm_universal_plane_init(sdev->ddev, &splane->plane, 1,
- &shmob_drm_plane_funcs,
- formats, ARRAY_SIZE(formats), NULL,
- DRM_PLANE_TYPE_OVERLAY, NULL);
-
- return ret;
+ return 0;
}