audio_alsaops: fix format conversion error handling bug
Returns a invalid format after fatal error,
instead of "0", which equals to PCM_FORMAT_S16_LE or
AUDIO_FORMAT_DEFAULT.
Also fix below build error:
hardware/libhardware/include/hardware/audio_alsaops.h:63:16:
error: cannot initialize return object of type 'enum pcm_format' with an rvalue of type 'int'
return 0;
hardware/libhardware/include/hardware/audio_alsaops.h:97:16:
error: cannot initialize return object of type 'audio_format_t' with an rvalue of type 'int'
return 0;
Signed-off-by: Jindong <jindong.yue@nxp.com>
Change-Id: Iabf5ae106d9c371c00ad5236326c6f38d1a9f116
diff --git a/include/hardware/audio_alsaops.h b/include/hardware/audio_alsaops.h
index 6a17a35..476c311 100644
--- a/include/hardware/audio_alsaops.h
+++ b/include/hardware/audio_alsaops.h
@@ -60,7 +60,7 @@
case AUDIO_FORMAT_PCM_FLOAT: /* there is no equivalent for float */
default:
LOG_ALWAYS_FATAL("pcm_format_from_audio_format: invalid audio format %#x", format);
- return 0;
+ return PCM_FORMAT_INVALID; /* doesn't get here, assert called above */
}
}
@@ -94,7 +94,7 @@
#endif
default:
LOG_ALWAYS_FATAL("audio_format_from_pcm_format: invalid pcm format %#x", format);
- return 0;
+ return AUDIO_FORMAT_INVALID; /* doesn't get here, assert called above */
}
}