Re: [PATCH] staging: unisys: use common return path

Dan Carpenter
2015-12-01T08:00:58Z

Doing One Err style error handling is often a mistake but it's ok here.
Just choose a better label name, though. "unlock". I have seen several
bugs caused because people used the label name "err" instead of
"unlock". Compare these two examples.

spin_unlock();
err:
return ret;

Do you see the bug? Now look at this code:

spin_unlock();
unlock:
return ret;

Just from looking at those few lines you can see that the intent was
to unlock but instead it just returns. In the first example, you need
to scroll to the start of the function and examine the context to see
what "err" was intended to do. And you're not likely to even be
suspicious of the err label because do nothing labels with ambiguos
label names are very common.

I have seen at least three places where an ambiguously named label was
placed after the spin unlock instead of before, where it was intended.

regards,
dan carpenter