Return different error code depending on the reason so that the caller can know the cause of the failure. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>