[24/44] drm/hx8357d: Use devm_drm_dev_alloc
diff mbox series

Message ID 20200403135828.2542770-25-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • devm_drm_dev_alloc, no more drmm_add_final_kfree
Related show

Commit Message

Daniel Vetter April 3, 2020, 1:58 p.m. UTC
Already using devm_drm_dev_init, so very simple replacment.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/tiny/hx8357d.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Eric Anholt April 3, 2020, 5:38 p.m. UTC | #1
On Fri, Apr 3, 2020 at 6:59 AM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> Already using devm_drm_dev_init, so very simple replacment.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Acked-by: Eric Anholt <eric@anholt.net>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index af7f3d10aac3..b4bc358a3269 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -226,17 +226,12 @@  static int hx8357d_probe(struct spi_device *spi)
 	u32 rotation = 0;
 	int ret;
 
-	dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
-	if (!dbidev)
-		return -ENOMEM;
+	dbidev = devm_drm_dev_alloc(dev, &hx8357d_driver,
+				    struct mipi_dbi_dev, drm);
+	if (IS_ERR(dbidev))
+		return PTR_ERR(dbidev);
 
 	drm = &dbidev->drm;
-	ret = devm_drm_dev_init(dev, drm, &hx8357d_driver);
-	if (ret) {
-		kfree(dbidev);
-		return ret;
-	}
-	drmm_add_final_kfree(drm, dbidev);
 
 	dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
 	if (IS_ERR(dc)) {