[Intel-gfx] [PATCH 15/59] drm/repaper: Use devm_drm_dev_alloc

Daniel Vetter daniel.vetter at ffwll.ch
Wed Apr 15 07:39:50 UTC 2020


Already using devm_drm_dev_init, so very simple replacment.

Acked-by: Noralf Trønnes <noralf at tronnes.org>
Acked-by: Sam Ravnborg <sam at ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
Cc: "Noralf Trønnes" <noralf at tronnes.org>
---
 drivers/gpu/drm/tiny/repaper.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

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;
-- 
2.25.1



More information about the Intel-gfx mailing list