From: Daniel Vetter Date: Wed, 15 Apr 2020 07:40:03 +0000 (+0200) Subject: drm/mcde: Use devm_drm_dev_alloc X-Git-Tag: baikal/mips/sdk5.9~13559^2~13^2~50 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=ec06e49e79bf24cf57dbc86703a3df2be661dab1;p=kernel.git drm/mcde: Use devm_drm_dev_alloc Already using devm_drm_dev_init, so very simple replacment. v2: Move misplaced double-assignement to next patch (Sam) Acked-by: Sam Ravnborg Reviewed-by: Linus Walleij Signed-off-by: Daniel Vetter Cc: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-29-daniel.vetter@ffwll.ch --- diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index 88cc6b4a7a64c..22003478db2c7 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -307,19 +307,12 @@ static int mcde_probe(struct platform_device *pdev) int ret; int i; - mcde = kzalloc(sizeof(*mcde), GFP_KERNEL); - if (!mcde) - return -ENOMEM; - mcde->dev = dev; - - ret = devm_drm_dev_init(dev, &mcde->drm, &mcde_drm_driver); - if (ret) { - kfree(mcde); - return ret; - } + mcde = devm_drm_dev_alloc(dev, &mcde_drm_driver, struct mcde, drm); + if (IS_ERR(mcde)) + return PTR_ERR(mcde); drm = &mcde->drm; drm->dev_private = mcde; - drmm_add_final_kfree(drm, mcde); + mcde->dev = dev; platform_set_drvdata(pdev, drm); /* Enable continuous updates: this is what Linux' framebuffer expects */