On 04.12.23 20:33, George Dunlap wrote:
On Mon, Dec 4, 2023 at 2:44 PM Juergen Gross <[email protected]> wrote:
Personally I prefer to keep the "goto out", rather than duplicating
the rcu_read_unlock().  I'd yield if Jan said he preferred
duplication, however.

I'm on the edge there actually.

In this case I'd prefer it my way, as it avoids having to scroll down to the
out: label to see what is happening there. Additionally it enables to get rid
of the ret variable.

The issue is, suppose we change something else, like needing to grab
(and release) another lock?  Sharing the exit path makes it easier to
avoid those kinds of mistakes.

Yes, this could happen. OTOH it could happen that an action is added
on the exit path which should _not_ be executed in the error case.

I agree that in case of more than one exit action needed the goto approach
is superior. For zero exit actions it is inferior, while for one it will
depend on the specific case IMHO.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to