Commit 005d29ac authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Ulf Hansson

pmdomain: qcom: rpmhpd: Simplify locking with guard()

Simplify error handling (less gotos) over locks with guard().
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarKonrad Dybcio <konradybcio@kernel.org>
Link: https://lore.kernel.org/r/20240823-cleanup-h-guard-pm-domain-v1-7-8320722eaf39@linaro.orgSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ba3a65c6
// 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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment