Commit 35b24eed authored by Daniel Vetter's avatar Daniel Vetter

drm/vboxvideo: Use devm_drm_dev_alloc

Straightforward conversion.
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-4-daniel.vetter@ffwll.ch
parent 2de955d0
...@@ -46,25 +46,19 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -46,25 +46,19 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret) if (ret)
return ret; return ret;
vbox = kzalloc(sizeof(*vbox), GFP_KERNEL); vbox = devm_drm_dev_alloc(&pdev->dev, &driver,
if (!vbox) struct vbox_private, ddev);
return -ENOMEM; if (IS_ERR(vbox))
return PTR_ERR(vbox);
ret = drm_dev_init(&vbox->ddev, &driver, &pdev->dev);
if (ret) {
kfree(vbox);
return ret;
}
vbox->ddev.pdev = pdev; vbox->ddev.pdev = pdev;
vbox->ddev.dev_private = vbox; vbox->ddev.dev_private = vbox;
pci_set_drvdata(pdev, vbox); pci_set_drvdata(pdev, vbox);
drmm_add_final_kfree(&vbox->ddev, vbox);
mutex_init(&vbox->hw_mutex); mutex_init(&vbox->hw_mutex);
ret = pci_enable_device(pdev); ret = pci_enable_device(pdev);
if (ret) if (ret)
goto err_dev_put; return ret;
ret = vbox_hw_init(vbox); ret = vbox_hw_init(vbox);
if (ret) if (ret)
...@@ -100,8 +94,6 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -100,8 +94,6 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
vbox_hw_fini(vbox); vbox_hw_fini(vbox);
err_pci_disable: err_pci_disable:
pci_disable_device(pdev); pci_disable_device(pdev);
err_dev_put:
drm_dev_put(&vbox->ddev);
return ret; return ret;
} }
...@@ -114,7 +106,6 @@ static void vbox_pci_remove(struct pci_dev *pdev) ...@@ -114,7 +106,6 @@ static void vbox_pci_remove(struct pci_dev *pdev)
vbox_mode_fini(vbox); vbox_mode_fini(vbox);
vbox_mm_fini(vbox); vbox_mm_fini(vbox);
vbox_hw_fini(vbox); vbox_hw_fini(vbox);
drm_dev_put(&vbox->ddev);
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment