]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PM: runtime: Fix ordering in pm_runtime_get_suppliers()
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 26 Mar 2021 10:56:18 +0000 (12:56 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 29 Mar 2021 17:27:09 +0000 (19:27 +0200)
rpm_active indicates how many times the supplier usage_count has been
incremented. Consequently it must be updated after pm_runtime_get_sync() of
the supplier, not before.

Fixes: 4c06c4e6cf63 ("driver core: Fix possible supplier PM-usage counter imbalance")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: 5.1+ <stable@vger.kernel.org> # 5.1+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/runtime.c

index d54e540067bfa7f8a79cab5ee074be146301e5ab..4fde37713c5809873efbf1e33cf23a807a52c921 100644 (file)
@@ -1690,8 +1690,8 @@ void pm_runtime_get_suppliers(struct device *dev)
                                device_links_read_lock_held())
                if (link->flags & DL_FLAG_PM_RUNTIME) {
                        link->supplier_preactivated = true;
-                       refcount_inc(&link->rpm_active);
                        pm_runtime_get_sync(link->supplier);
+                       refcount_inc(&link->rpm_active);
                }
 
        device_links_read_unlock(idx);