prevent the use goto statements

Signed-off-by: zwliew <zhaoweiliew@gmail.com>