Re: [PATCH] af_unix: Don't set err in unix_stream_read_generic unless there was an error

From: David Miller
Date: Tue Feb 16 2016 - 20:07:16 EST


From: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
Date: Wed, 17 Feb 2016 00:24:51 +0000

> I agree that 'if (err) goto cleanup;' is widely used and is generally
> understandable (though more creative uses of goto are often not).
>
> My objection was to 'err = -EFOO; if (cond) goto cleanup;'.  That is
> definitely not clear and it hides mistakes like this.

I don't see any difference whatsoever.

Part of the convention of the cleanup blob at the end of the
function is that error propagate to it's return statement via
a variable.

If this code wanted to handle that in more than one way, it is
the problem of this function, not of the convention itself.