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

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-31-daniel.vetter@ffwll.ch
drivers/gpu/drm/ingenic/ingenic-drm.c

index 24cc3587cea5db27927c42ef15050ca29670ec80..2dd1f3020fcb7b8d4f59b1ef64443967e5488b3c 100644 (file)
@@ -611,9 +611,10 @@ static int ingenic_drm_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-       if (!priv)
-               return -ENOMEM;
+       priv = devm_drm_dev_alloc(dev, &ingenic_drm_driver_data,
+                                 struct ingenic_drm, drm);
+       if (IS_ERR(priv))
+               return PTR_ERR(priv);
 
        priv->soc_info = soc_info;
        priv->dev = dev;
@@ -622,13 +623,6 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, priv);
 
-       ret = devm_drm_dev_init(dev, drm, &ingenic_drm_driver_data);
-       if (ret) {
-               kfree(priv);
-               return ret;
-       }
-       drmm_add_final_kfree(drm, priv);
-
        ret = drmm_mode_config_init(drm);
        if (ret)
                return ret;