Optimize return code check.

Instead of doing two comparisons, make just one and make this check
faster.

Signed-off-by: Leonardo Garcia <lagarcia@br.ibm.com>