Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [Medium] Unbalanced pm_runtime_get_sync() and pm_runtime_forbid() causing a 
runtime PM usage count leak on driver probe error paths.
--

--- Patch [1]: [PATCH] drm/xe: fix autosuspend cleanup during teardown ---
commit 33bf65f058f06f66ae199db570fd2ab554bf8591
Author: Guangshuo Li <[email protected]>

drm/xe: fix autosuspend cleanup during teardown

This patch adds the missing pm_runtime_dont_use_autosuspend() call to the
runtime PM teardown path to prevent a usage count leak.

Cc: [email protected]

> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index a5289a9df8d25..e05290400c650 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -518,6 +518,7 @@ static void xe_pm_runtime_fini(struct xe_device *xe)
>       if (IS_SRIOV_VF(xe))
>               return;
>  
> +     pm_runtime_dont_use_autosuspend(dev);
>       pm_runtime_get_sync(dev);
>       pm_runtime_forbid(dev);
>  }

[Severity: Medium]
This is a pre-existing issue, but does calling pm_runtime_get_sync() and
pm_runtime_forbid() unconditionally here cause a runtime PM usage count leak
on probe error paths?

If xe_pm_init() fails early in xe_pci_probe() (for example, if
xe_pm_set_vram_threshold() returns an error), the error handler calls
xe_pci_remove() which unconditionally executes the teardown functions.

Because xe_pm_init() failed before it could call xe_pm_runtime_init(),
pm_runtime_allow() and pm_runtime_put() were never called to balance the PCI
core's initial reference count.

When xe_pm_runtime_fini() executes pm_runtime_get_sync() and
pm_runtime_forbid() on that error path, it increments the usage count without
checking if initialization actually completed. Will this artificially inflate
the device's usage count and prevent the unbound device from ever being
runtime-suspended after the failed probe?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to