From nobody Mon Feb 9 20:34:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E53F0EB64DA for ; Thu, 22 Jun 2023 09:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232311AbjFVJax (ORCPT ); Thu, 22 Jun 2023 05:30:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbjFVJ3q (ORCPT ); Thu, 22 Jun 2023 05:29:46 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D544234 for ; Thu, 22 Jun 2023 02:22:46 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:991a:a831:ea4b:6058]) by xavier.telenet-ops.be with bizsmtp id C9Nj2A0091yfRTD019NjEL; Thu, 22 Jun 2023 11:22:43 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qCGWX-000BwK-Ob; Thu, 22 Jun 2023 11:22:43 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qCGWZ-003Vwt-Bd; Thu, 22 Jun 2023 11:22:43 +0200 From: Geert Uytterhoeven To: Laurent Pinchart , Kieran Bingham , David Airlie , Daniel Vetter , Thomas Zimmermann , Magnus Damm Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 17/39] drm: renesas: shmobile: Use drmm_universal_plane_alloc() Date: Thu, 22 Jun 2023 11:21:29 +0200 Message-Id: <9af0b0e18c6f3ce3348cc728f177bf466e30e66a.1687423204.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- Plane (and connector) structures are still allocated with devm_kzalloc() in several other drivers... --- .../drm/renesas/shmobile/shmob_drm_plane.c | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c b/drivers/g= pu/drm/renesas/shmobile/shmob_drm_plane.c index 0b2ab153e9ae76df..1fb68b5fe915b8dc 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c @@ -176,16 +176,9 @@ static int shmob_drm_plane_disable(struct drm_plane *p= lane, return 0; } =20 -static void shmob_drm_plane_destroy(struct drm_plane *plane) -{ - drm_plane_force_disable(plane); - drm_plane_cleanup(plane); -} - static const struct drm_plane_funcs shmob_drm_plane_funcs =3D { .update_plane =3D shmob_drm_plane_update, .disable_plane =3D shmob_drm_plane_disable, - .destroy =3D shmob_drm_plane_destroy, }; =20 static const uint32_t formats[] =3D { @@ -204,19 +197,16 @@ static const uint32_t formats[] =3D { int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int ind= ex) { struct shmob_drm_plane *splane; - int ret; =20 - splane =3D devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL); - if (splane =3D=3D NULL) - return -ENOMEM; + splane =3D 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); =20 splane->index =3D index; splane->alpha =3D 255; =20 - ret =3D 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; } --=20 2.34.1