'ret == 0' is checked twice, imo one time is enough :)