[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dd1383fd-39d2-47e9-b559-21f20c995310@linaro.org>
Date: Thu, 22 Aug 2024 18:44:48 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] soc: qcom: pmic_glink: simplify locking with guard()
On 22/08/2024 18:33, Krzysztof Kozlowski wrote:
> Simplify error handling over locks with guard(). In few places this
> elimiates error gotos and local variables. Switch to guard() everywhere
> in the code for consistency, even if it does not bring benefit in such
> places.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
>
> ---
>
...
>
> static void pmic_glink_rpmsg_remove(struct rpmsg_device *rpdev)
> {
> struct pmic_glink *pg;
>
> - mutex_lock(&__pmic_glink_lock);
> + guard(mutex)(&__pmic_glink_lock);
> pg = __pmic_glink;
> if (!pg)
> - goto out_unlock;
> + return;
>
> - mutex_lock(&pg->state_lock);
> + guard(mutex)(&pg->state_lock);
> pg->ept = NULL;
> pmic_glink_state_notify_clients(pg);
> - mutex_unlock(&pg->state_lock);
> -out_unlock:
> - mutex_unlock(&__pmic_glink_lock);
I am really sorry, I thought I built it with W=1, but turns out I did
not. Code needs a fix, I will send a v2.
Best regards,
Krzysztof
Powered by blists - more mailing lists