Fix out set parameters success return code
str_params_get_str returns length of returned string value
on success, but HAL set parameters should return 0 on success.
This change fixes MSD to primary HAL audio patch creation on
a hikey960 target variant supporting MSD.
Change-Id: Idba8ba7283b0a4c42fa4b69e501cf0e008558c60
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 56b3e14..02ce250 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -362,12 +362,16 @@
struct alsa_audio_device *adev = out->dev;
struct str_parms *parms;
char value[32];
- int ret, val = 0;
+ int val = 0;
+ int ret = -EINVAL;
+
+ if (kvpairs == NULL || kvpairs[0] == 0) {
+ return 0;
+ }
parms = str_parms_create_str(kvpairs);
- ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value));
- if (ret >= 0) {
+ if (str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value)) >= 0) {
val = atoi(value);
pthread_mutex_lock(&adev->lock);
pthread_mutex_lock(&out->lock);
@@ -377,6 +381,7 @@
}
pthread_mutex_unlock(&out->lock);
pthread_mutex_unlock(&adev->lock);
+ ret = 0;
}
str_parms_destroy(parms);