From: Daniel Vetter Date: Wed, 15 Apr 2020 07:40:10 +0000 (+0200) Subject: drm/cirrus: Use devm_drm_dev_alloc X-Git-Tag: baikal/mips/sdk5.9~13559^2~13^2~45 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=f69eca8ea7e4b86dc8fffdd37ec27793b66b7dc6;p=kernel.git drm/cirrus: Use devm_drm_dev_alloc Already using devm_drm_dev_init, so very simple replacment. Acked-by: Noralf Trønnes Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: Sam Ravnborg Cc: "Noralf Trønnes" Cc: Rob Herring Cc: Thomas Zimmermann Cc: virtualization@lists.linux-foundation.org Cc: Emil Velikov Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-36-daniel.vetter@ffwll.ch --- diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c index a36269717c3bc..4b65637147ba8 100644 --- a/drivers/gpu/drm/cirrus/cirrus.c +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -567,18 +567,13 @@ static int cirrus_pci_probe(struct pci_dev *pdev, return ret; ret = -ENOMEM; - cirrus = kzalloc(sizeof(*cirrus), GFP_KERNEL); - if (cirrus == NULL) - return ret; + cirrus = devm_drm_dev_alloc(&pdev->dev, &cirrus_driver, + struct cirrus_device, dev); + if (IS_ERR(cirrus)) + return PTR_ERR(cirrus); dev = &cirrus->dev; - ret = devm_drm_dev_init(&pdev->dev, dev, &cirrus_driver); - if (ret) { - kfree(cirrus); - return ret; - } dev->dev_private = cirrus; - drmm_add_final_kfree(dev, cirrus); cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));