Re: thunderbolt: Use common error handling code in update_property_block()

From: Markus Elfring
Date: Wed Sep 25 2024 - 05:40:38 EST


> It is fine to use goto as it is described in the document you linked but
> this what you are doing is certainly not fine, at least in the code I'm
> maintaining:
>
> out_unlock:
> mutex_unlock(&xd->lock);
> mutex_unlock(&xdomain_lock);
> return;
>
> out_free_dir:
> tb_property_free_dir(dir);
> goto out_unlock;
>
> This "goto out_unlock" adds another goto to upwards which makes it
> really hard to follow because the flow is not anymore just downwards.

Would you like to benefit any more from the application of
scope-based resource management?

Regards,
Markus