[Intel-xe] [PATCH 02/12] drm/xe: Skip calling drm_dev_put on probe error
Matthew Brost
matthew.brost at intel.com
Wed Nov 8 09:33:40 UTC 2023
On Wed, Nov 08, 2023 at 01:33:34AM +0100, Michał Winiarski wrote:
> DRM device used by Xe is managed, which means that final ref will be
> dropped on driver detach.
>
Where is the detach called if xe_pci_probe() fails? I'm struggling to find that.
Matt
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> ---
> drivers/gpu/drm/xe/xe_device.c | 12 +++++-------
> drivers/gpu/drm/xe/xe_pci.c | 5 +----
> 2 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 078c92576062a..78374997cbf6f 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -217,11 +217,11 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
> xe->drm.anon_inode->i_mapping,
> xe->drm.vma_offset_manager, false, false);
> if (WARN_ON(err))
> - goto err_put;
> + goto err;
>
> err = drmm_add_action_or_reset(&xe->drm, xe_device_destroy, NULL);
> if (err)
> - goto err_put;
> + goto err;
>
> xe->info.devid = pdev->device;
> xe->info.revid = pdev->revision;
> @@ -247,18 +247,16 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
> if (!xe->ordered_wq || !xe->unordered_wq) {
> drm_err(&xe->drm, "Failed to allocate xe workqueues\n");
> err = -ENOMEM;
> - goto err_put;
> + goto err;
> }
>
> err = xe_display_create(xe);
> if (WARN_ON(err))
> - goto err_put;
> + goto err;
>
> return xe;
>
> -err_put:
> - drm_dev_put(&xe->drm);
> -
> +err:
> return ERR_PTR(err);
> }
>
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 007e272d2758f..84f3e4d901502 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -700,7 +700,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> pci_set_drvdata(pdev, xe);
> err = pci_enable_device(pdev);
> if (err)
> - goto err_drm_put;
> + return err;
>
> pci_set_master(pdev);
>
> @@ -742,9 +742,6 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> err_pci_disable:
> pci_disable_device(pdev);
>
> -err_drm_put:
> - drm_dev_put(&xe->drm);
> -
> return err;
> }
>
> --
> 2.42.0
>
More information about the Intel-xe
mailing list