Commit c0c33442 authored by Adrian Hunter's avatar Adrian Hunter Committed by Rafael J. Wysocki
Browse files

PM: runtime: Fix ordering in pm_runtime_get_suppliers()



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: 4c06c4e6 ("driver core: Fix possible supplier PM-usage counter imbalance")
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: 5.1+ <stable@vger.kernel.org> # 5.1+
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a5e13c6d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);