From: Daniel Vetter Date: Wed, 15 Apr 2020 07:39:53 +0000 (+0200) Subject: drm/ili9341: Use devm_drm_dev_alloc X-Git-Tag: baikal/mips/sdk5.9~13559^2~13^2~58 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=443728df5b498cf85e63651725090ef1bfcce22d;p=kernel.git drm/ili9341: Use devm_drm_dev_alloc Already using devm_drm_dev_init, so very simple replacment. Acked-by: David Lechner Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: "Noralf Trønnes" Cc: Sam Ravnborg Cc: Daniel Vetter Cc: Eric Anholt Cc: David Lechner Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-19-daniel.vetter@ffwll.ch --- diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c index e152de3690192..bb819f45a5d3b 100644 --- a/drivers/gpu/drm/tiny/ili9341.c +++ b/drivers/gpu/drm/tiny/ili9341.c @@ -183,18 +183,13 @@ static int ili9341_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, &ili9341_driver, + struct mipi_dbi_dev, drm); + if (IS_ERR(dbidev)) + return PTR_ERR(dbidev); dbi = &dbidev->dbi; drm = &dbidev->drm; - ret = devm_drm_dev_init(dev, drm, &ili9341_driver); - if (ret) { - kfree(dbidev); - return ret; - } - drmm_add_final_kfree(drm, dbidev); dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(dbi->reset)) {