summaryrefslogtreecommitdiff
path: root/drivers/pmdomain
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-08-23 14:51:11 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2024-09-13 12:21:04 +0200
commit005d29ac591a8d3cf0fb6f34c2045d0690992148 (patch)
treeb4bc4306dc9a506499039d6105d03de2a55c116d /drivers/pmdomain
parentba3a65c69bdbff04ea5699597bf491de5cbe82e9 (diff)
pmdomain: qcom: rpmhpd: Simplify locking with guard()
Simplify error handling (less gotos) over locks with guard(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Konrad Dybcio <konradybcio@kernel.org> Link: https://lore.kernel.org/r/20240823-cleanup-h-guard-pm-domain-v1-7-8320722eaf39@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/pmdomain')
-rw-r--r--drivers/pmdomain/qcom/rpmhpd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/pmdomain/qcom/rpmhpd.c b/drivers/pmdomain/qcom/rpmhpd.c
index d2cb4271a1ca..65505e1e2219 100644
--- a/drivers/pmdomain/qcom/rpmhpd.c
+++ b/drivers/pmdomain/qcom/rpmhpd.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.*/
+#include <linux/cleanup.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -775,9 +776,9 @@ static int rpmhpd_set_performance_state(struct generic_pm_domain *domain,
unsigned int level)
{
struct rpmhpd *pd = domain_to_rpmhpd(domain);
- int ret = 0, i;
+ int ret, i;
- mutex_lock(&rpmhpd_lock);
+ guard(mutex)(&rpmhpd_lock);
for (i = 0; i < pd->level_count; i++)
if (level <= pd->level[i])
@@ -797,14 +798,12 @@ static int rpmhpd_set_performance_state(struct generic_pm_domain *domain,
ret = rpmhpd_aggregate_corner(pd, i);
if (ret)
- goto out;
+ return ret;
}
pd->corner = i;
-out:
- mutex_unlock(&rpmhpd_lock);
- return ret;
+ return 0;
}
static int rpmhpd_update_level_mapping(struct rpmhpd *rpmhpd)