[PATCH 6.18 054/122] drm/xe/configfs: Fix is_bound() pci_dev lifetime

Greg Kroah-Hartman
2026-02-04T15:31:01Z

From: Shuicheng Lin <shuicheng.lin@intel.com>

[ Upstream commit c1ed856c09d0d730c2f63bbb757cb6011db148f9 ]

Move pci_dev_put() after pci_dbg() to avoid using pdev after dropping its
reference.

Fixes: 2674f1ef29f46 ("drm/xe/configfs: Block runtime attribute changes")
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patch.msgid.link/20260121173750.3090907-2-shuicheng.lin@intel.com
(cherry picked from commit 63b33604365bdca43dee41bab809da2230491036)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_configfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 1396634231857..6688b2954d20b 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -258,11 +258,10 @@ static bool is_bound(struct xe_config_group_device *dev)
return false;

ret = pci_get_drvdata(pdev);
- pci_dev_put(pdev);
-
if (ret)
pci_dbg(pdev, "Already bound to driver\n");

+ pci_dev_put(pdev);
return ret;
}

--
2.51.0