[PATCH 08/14] Cleanup: remove dead code and return the correct return code