]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/mcde: Use devm_drm_dev_alloc
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 15 Apr 2020 07:40:03 +0000 (09:40 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 28 Apr 2020 14:03:16 +0000 (16:03 +0200)
Already using devm_drm_dev_init, so very simple replacment.

v2: Move misplaced double-assignement to next patch (Sam)

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-29-daniel.vetter@ffwll.ch
drivers/gpu/drm/mcde/mcde_drv.c

index 88cc6b4a7a64cac1f932623e25350d466687ef02..22003478db2c7355e8f48478ca5405785ef14f60 100644 (file)
@@ -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 */