Re: [PATCH 2/8] staging: r8188eu: don't set _SUCCESS again
From: Dan Carpenter
Date: Mon Apr 11 2022 - 06:19:17 EST
On Sat, Apr 09, 2022 at 05:15:51PM +0200, Martin Kaiser wrote:
> ret is initialized to _SUCCESS, there's no need to set it again.
>
> Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
I liked the original code better. Otherwise you wonder, is it
intentional to return success on this path. Smatch has a static
checker warning for these because most of the time it is a bug.
You can set "ret = _SUCCESS;" within 4 lines of the goto to silence
the warning. A second, not as good option, is to add comment
"/* deliberatly returning success */" which saves a little time, but
also wastes a little time.
If you have to remove something, then remove the initializer.
The compiler is probably clever enough to remove these assignments so
it doesn't make sense to add an additional way to annotate success
paths.
regards,
dan carpenter