[PATCH 11/26] android/hal-audio: Allow to return 0 from get_presets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch makes legal to return 0 from get_presets which is useful to
inform HAL core that codec is not initialized properly and codec should
not be used (it has no caps and no presets).
---
 android/hal-audio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/android/hal-audio.c b/android/hal-audio.c
index 416a3ad..1ab4b01 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -315,6 +315,9 @@ static int ipc_open_cmd(const struct audio_codec *codec)
 	cmd->codec = codec->type;
 	cmd->presets = codec->get_presets(cmd->preset, &cmd_len);
 
+	if (!cmd->presets)
+		return 0;
+
 	cmd_len += sizeof(*cmd);
 
 	result = audio_ipc_cmd(AUDIO_SERVICE_ID, AUDIO_OP_OPEN, cmd_len, cmd,
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux