diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2017-02-13 15:19:36 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-02-14 17:42:14 +0100 |
commit | adb788d97cad1c752f68a35619f2d81ea03002cd (patch) | |
tree | 85cf9f772d6d517b0a7f448dc7c4208526b83594 | |
parent | 58735a9cf911eb09ba830a505d1dc2c9d130ef9e (diff) | |
download | android_hardware_samsung-adb788d97cad1c752f68a35619f2d81ea03002cd.tar.gz android_hardware_samsung-adb788d97cad1c752f68a35619f2d81ea03002cd.tar.bz2 android_hardware_samsung-adb788d97cad1c752f68a35619f2d81ea03002cd.zip |
audio: Fix device table access in get_snd_device_name()
We have a value for SND_DEVICE_NONE so we should use that. There is no
field for SND_DEVICE_MIN so we need to check it is bigger.
Change-Id: I041930c8c4b552d45804a178aeb1aa981ae7c13f
-rw-r--r-- | audio/audio_hw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index ea69f25..61b28e2 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -440,7 +440,8 @@ static const char *get_snd_device_name(snd_device_t snd_device) { const char *name = NULL; - if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX) + if (snd_device == SND_DEVICE_NONE || + (snd_device > SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX)) name = device_table[snd_device]; ALOGE_IF(name == NULL, "%s: invalid snd device %d", __func__, snd_device); |