sm8550-common: audio-impl: Verify that hal implements get_audio_port before calling

Change-Id: I3652382433d365407bf006d71f36743aa89a76ee
This commit is contained in:
Aaron Kling
2022-04-27 00:47:59 -05:00
committed by chaptsand
parent 3b377ac48d
commit c99d9755e1

View File

@@ -404,6 +404,10 @@ template <typename HalPort>
Return<void> Device::getAudioPortImpl(const AudioPort& port, getAudioPort_cb _hidl_cb,
int (*halGetter)(audio_hw_device_t*, HalPort*),
const char* halGetterName) {
if (halGetter == nullptr) {
_hidl_cb(Result::NOT_SUPPORTED, port);
return Void();
}
HalPort halPort;
if (status_t status = HidlUtils::audioPortToHal(port, &halPort); status != NO_ERROR) {
_hidl_cb(analyzeStatus("audioPortToHal", status), port);