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