Re: [PATCH 2/2] soc: qcom: pmic_glink: simplify locking with guard()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> 
> ---
> 

...

>  
>  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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux