[PATCH] driver core: Use pm_runtime_resume_and_get() instead of open-coding it

phucduc.bui@gmail.com posted 1 patch 3 days, 17 hours ago
drivers/base/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] driver core: Use pm_runtime_resume_and_get() instead of open-coding it
Posted by phucduc.bui@gmail.com 3 days, 17 hours ago
From: bui duc phuc <phucduc.bui@gmail.com>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle()
error handling pattern with pm_runtime_resume_and_get(), which already
does this internally.

No functional change.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/base/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 4c0c373998a1..a54cfe48ec80 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -817,10 +817,8 @@ struct device_link *device_link_add(struct device *consumer,
 		return NULL;
 
 	if (flags & DL_FLAG_PM_RUNTIME && flags & DL_FLAG_RPM_ACTIVE) {
-		if (pm_runtime_get_sync(supplier) < 0) {
-			pm_runtime_put_noidle(supplier);
+		if (pm_runtime_resume_and_get(supplier) < 0)
 			return NULL;
-		}
 	}
 
 	if (!(flags & DL_FLAG_STATELESS))
-- 
2.43.0