[Intel-xe] [PATCH] drm/xe: Do not forget to drm_dev_put() in xe_pci_probe():
Lucas De Marchi
lucas.demarchi at intel.com
Sat May 20 04:56:17 UTC 2023
On Fri, May 19, 2023 at 04:48:02PM -0300, Gustavo Sousa wrote:
>We should also call drm_dev_put() when calling xe_device_probe().
I guess you meant:
drm_dev_put() should also be called if xe_device_probe() fails.
>
>Signed-off-by: Gustavo Sousa <gustavo.sousa at intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
Lucas De Marchi
>---
> drivers/gpu/drm/xe/xe_pci.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
>index e789a50a1310..2d0d50dcd396 100644
>--- a/drivers/gpu/drm/xe/xe_pci.c
>+++ b/drivers/gpu/drm/xe/xe_pci.c
>@@ -639,10 +639,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> subplatform_desc = find_subplatform(xe, desc);
>
> err = xe_info_init(xe, desc, subplatform_desc);
>- if (err) {
>- drm_dev_put(&xe->drm);
>- return err;
>- }
>+ if (err)
>+ goto err_drm_put;
>
> xe_display_info_init(xe);
>
>@@ -668,10 +666,8 @@ 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) {
>- drm_dev_put(&xe->drm);
>- return err;
>- }
>+ if (err)
>+ goto err_drm_put;
>
> pci_set_master(pdev);
>
>@@ -679,14 +675,20 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> drm_dbg(&xe->drm, "can't enable MSI");
>
> err = xe_device_probe(xe);
>- if (err) {
>- pci_disable_device(pdev);
>- return err;
>- }
>+ if (err)
>+ goto err_pci_disable;
>
> xe_pm_runtime_init(xe);
>
> return 0;
>+
>+err_pci_disable:
>+ pci_disable_device(pdev);
>+
>+err_drm_put:
>+ drm_dev_put(&xe->drm);
>+
>+ return err;
> }
>
> static void xe_pci_shutdown(struct pci_dev *pdev)
>--
>2.40.1
>
More information about the Intel-xe
mailing list