quoted
If the code doing the allocation is changed in the future the single
cleanup can stay whereas multiple labels have to be rewritten again.
No, they don't unless you choose bad label names. Perhaps numbered
labels? We don't get a lot of those in the kernel any more. Label
name should be based on what the label does. Often I see bad label
names like generic labels:
foo = kmalloc();
if (!foo)
goto out;
What is out going to do? Another common anti-pattern is come-from
labels:
foo = kmalloc();
if (!foo)
goto kmalloc_failed;
Obviously, we can see from the if statement that the alloc failed and
you *just* know the next line is going to be is going to be:
if (invalid)
goto kmalloc_failed;
Which is wrong because kmalloc didn't fail... But if the label name is
based on what it does then, when you add or a remove an allocation, you
just have to edit the one thing.
Would you be interested in an update on a topic like “Source code review
around jump label usage”?
https://lkml.org/lkml/2015/12/11/378
Regards,
Markus