From ad169fc9afdd584bd11251d37f4834c41fa6efff Mon Sep 17 00:00:00 2001 From: "Christopher N. Hesse" Date: Thu, 12 Jul 2018 13:51:43 +0200 Subject: [PATCH] audio: improve log message to support for devices that dont have an amp Change-Id: I3fe824c4dbdb57bb0d63b395cfcef2f9dbbe556b Signed-off-by: Abhay Ruparel (cherry picked from commit c487bbe38958d79aa7391b928f15e9ed5f8d1d4b) --- audio/audio_hw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 94c105f..1e99dcb 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -201,6 +201,10 @@ static int amplifier_open(void) rc = hw_get_module(AMPLIFIER_HARDWARE_MODULE_ID, (const hw_module_t **) &module); if (rc) { + if (rc == -ENOENT) { + // no amplifier HAL present + return -ENOENT; + } ALOGV("%s: Failed to obtain reference to amplifier module: %s\n", __func__, strerror(-rc)); return -ENODEV; @@ -4309,7 +4313,7 @@ static int adev_open(const hw_module_t *module, const char *name, return -EINVAL; } - if (amplifier_open() != 0) { + if (amplifier_open() != -ENOENT) { ALOGE("Amplifier initialization failed"); } -- 2.20.1