Commit 6fedf842 authored by Gustavo Sousa's avatar Gustavo Sousa Committed by Rodrigo Vivi

drm/xe: Do not forget to drm_dev_put() in xe_pci_probe()

The function drm_dev_put() should also be called if xe_device_probe()
fails.

v2:
  - Improve commit message. (Lucas)
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20230519194802.578182-1-gustavo.sousa@intel.comSigned-off-by: default avatarGustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 82f428b6
...@@ -614,10 +614,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -614,10 +614,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
subplatform_desc = find_subplatform(xe, desc); subplatform_desc = find_subplatform(xe, desc);
err = xe_info_init(xe, desc, subplatform_desc); err = xe_info_init(xe, desc, subplatform_desc);
if (err) { if (err)
drm_dev_put(&xe->drm); goto err_drm_put;
return err;
}
drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) dma_m_s:%d tc:%d", drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) dma_m_s:%d tc:%d",
desc->platform_name, desc->platform_name,
...@@ -640,10 +638,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -640,10 +638,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_drvdata(pdev, xe); pci_set_drvdata(pdev, xe);
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) { if (err)
drm_dev_put(&xe->drm); goto err_drm_put;
return err;
}
pci_set_master(pdev); pci_set_master(pdev);
...@@ -651,14 +647,20 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -651,14 +647,20 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
drm_dbg(&xe->drm, "can't enable MSI"); drm_dbg(&xe->drm, "can't enable MSI");
err = xe_device_probe(xe); err = xe_device_probe(xe);
if (err) { if (err)
pci_disable_device(pdev); goto err_pci_disable;
return err;
}
xe_pm_runtime_init(xe); xe_pm_runtime_init(xe);
return 0; 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) static void xe_pci_shutdown(struct pci_dev *pdev)
......
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