public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Madhur Kumar <madhurkumar004@gmail.com>
To: yongqin.liu@linaro.org
Cc: airlied@gmail.com, dri-devel@lists.freedesktop.org,
	jstultz@google.com, kong.kongxinwei@hisilicon.com,
	linux-kernel@vger.kernel.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, simona@ffwll.ch, sumit.semwal@linaro.org,
	tiantao6@hisilicon.com, tzimmermann@suse.de,
	xinliang.liu@linaro.org, Madhur Kumar <madhurkumar004@gmail.com>
Subject: [PATCH RESEND] drm/hisilicon: kirin: Convert to drmm_mode_config_init() and drop manual cleanup
Date: Wed,  5 Nov 2025 21:39:31 +0530	[thread overview]
Message-ID: <20251105160931.466664-1-madhurkumar004@gmail.com> (raw)
In-Reply-To: <20251022114438.1096382-1-madhurkumar004@gmail.com>

switch mode_config initialization to drmm_mode_config_init() so that the
lifetime is tied to drm_device. Remove explicit drm_mode_config_cleanup()
from error and cleanup path since cleanup is now managed by DRM.

Signed-off-by: Madhur Kumar <madhurkumar004@gmail.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index 1e1c87be1204..47f682097615 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -160,7 +160,10 @@ static int kirin_drm_kms_init(struct drm_device *dev,
 	int ret;
 
 	/* dev->mode_config initialization */
-	drm_mode_config_init(dev);
+	ret = drmm_mode_config_init(dev);
+	if (ret)
+		return ret;
+	
 	dev->mode_config.min_width = 0;
 	dev->mode_config.min_height = 0;
 	dev->mode_config.max_width = driver_data->config_max_width;
@@ -170,8 +173,7 @@ static int kirin_drm_kms_init(struct drm_device *dev,
 	/* display controller init */
 	ret = kirin_drm_private_init(dev, driver_data);
 	if (ret)
-		goto err_mode_config_cleanup;
-
+		return ret;
 	/* bind and init sub drivers */
 	ret = component_bind_all(dev->dev, dev);
 	if (ret) {
@@ -198,8 +200,6 @@ static int kirin_drm_kms_init(struct drm_device *dev,
 	component_unbind_all(dev->dev, dev);
 err_private_cleanup:
 	kirin_drm_private_cleanup(dev);
-err_mode_config_cleanup:
-	drm_mode_config_cleanup(dev);
 	return ret;
 }
 
@@ -208,7 +208,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
 	drm_kms_helper_poll_fini(dev);
 	drm_atomic_helper_shutdown(dev);
 	kirin_drm_private_cleanup(dev);
-	drm_mode_config_cleanup(dev);
 
 	return 0;
 }
-- 
2.51.1.dirty


      parent reply	other threads:[~2025-11-05 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 11:44 [PATCH] drm/hisilicon: kirin: Convert to drmm_mode_config_init() and drop manual cleanup Madhur Kumar
2025-10-22 17:36 ` John Stultz
2025-11-05 16:09 ` Madhur Kumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251105160931.466664-1-madhurkumar004@gmail.com \
    --to=madhurkumar004@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jstultz@google.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.org \
    --cc=tiantao6@hisilicon.com \
    --cc=tzimmermann@suse.de \
    --cc=xinliang.liu@linaro.org \
    --cc=yongqin.liu@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox