[PATCH] staging: sunxi: cedrus: centralize cedrus_open exit

Dan Carpenter dan.carpenter at oracle.com
Mon Apr 25 02:20:49 PDT 2022


On Sat, Apr 23, 2022 at 02:01:11PM -0400, Ian Cowan wrote:
> Refactor the cedrus_open() function so that there is only one exit to
> the function instead of 2. This prevents a future change from preventing
> the mutex from being unlocked after a successful exit.
> 
> Signed-off-by: Ian Cowan <ian at linux.cowan.aero>

No.  You are just making the code ugly and complicated for no reason.

I work in static analysis so I have focussed a lot of attention on
locking bugs.  In real life this theory is totally bogus.  Single exit
paths only cause bugs, they don't prevent bugs.

regards,
dan carpenter




More information about the linux-arm-kernel mailing list