Fix 'ret' may be used uninitialized warning
(cherry picked from commit 60c8ef902fbeef0cf690fee69104555852100396)