From 60dc4712efa15677240aacbf2f6bc62f3595f718 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Wed, 15 Apr 2020 09:39:58 +0200 Subject: [PATCH] drm/tidss: Use devm_drm_dev_alloc Already using devm_drm_dev_init, so very simple replacment. Tested-by: Jyri Sarha Acked-by: Sam Ravnborg Reviewed-by: Tomi Valkeinen Signed-off-by: Daniel Vetter Cc: Jyri Sarha Cc: Tomi Valkeinen Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-24-daniel.vetter@ffwll.ch --- drivers/gpu/drm/tidss/tidss_drv.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c index ad449d104306c..7d4465d58be82 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.c +++ b/drivers/gpu/drm/tidss/tidss_drv.c @@ -135,20 +135,13 @@ static int tidss_probe(struct platform_device *pdev) dev_dbg(dev, "%s\n", __func__); - /* Can't use devm_* since drm_device's lifetime may exceed dev's */ - tidss = kzalloc(sizeof(*tidss), GFP_KERNEL); - if (!tidss) - return -ENOMEM; + tidss = devm_drm_dev_alloc(&pdev->dev, &tidss_driver, + struct tidss_device, ddev); + if (IS_ERR(tidss)) + return PTR_ERR(tidss); ddev = &tidss->ddev; - ret = devm_drm_dev_init(&pdev->dev, ddev, &tidss_driver); - if (ret) { - kfree(ddev); - return ret; - } - drmm_add_final_kfree(ddev, tidss); - tidss->dev = dev; tidss->feat = of_device_get_match_data(dev); -- 2.39.5