You are right,  ret=-1 is not correct.