[19/44] drm/repaper: Use devm_drm_dev_alloc
diff mbox series

Message ID 20200403135828.2542770-20-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: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/tiny/repaper.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Noralf Trønnes April 5, 2020, 10 a.m. UTC | #1
Den 03.04.2020 15.58, skrev Daniel Vetter:
> Already using devm_drm_dev_init, so very simple replacment.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---

Acked-by: Noralf Trønnes <noralf@tronnes.org>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index 862c3ee6055d..1c0e7169545b 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -1002,19 +1002,13 @@  static int repaper_probe(struct spi_device *spi)
 		}
 	}
 
-	epd = kzalloc(sizeof(*epd), GFP_KERNEL);
-	if (!epd)
-		return -ENOMEM;
+	epd = devm_drm_dev_alloc(dev, &repaper_driver,
+				 struct repaper_epd, drm);
+	if (IS_ERR(epd))
+		return PTR_ERR(epd);
 
 	drm = &epd->drm;
 
-	ret = devm_drm_dev_init(dev, drm, &repaper_driver);
-	if (ret) {
-		kfree(epd);
-		return ret;
-	}
-	drmm_add_final_kfree(drm, epd);
-
 	ret = drmm_mode_config_init(drm);
 	if (ret)
 		return ret;