diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-31 12:25:02 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-31 12:25:02 +0300 |
commit | c9b95e5961c0294e0efffeaa847c1a1e6369204c (patch) | |
tree | 384daa5e36a795d48475d445b3857b47e0b3f8d3 /sound/hda/hdmi_chmap.c | |
parent | bad60e6f259a01cf9f29a1ef8d435ab6c60b2de9 (diff) | |
parent | 0984d159c8ad6618c6ebd9f00bc3f374fa52bc35 (diff) | |
download | linux-c9b95e5961c0294e0efffeaa847c1a1e6369204c.tar.xz |
Merge tag 'sound-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
"The majority of this update is about ASoC, including a few new
drivers, and the rest are mostly minor changes. The only substantial
change in ALSA core is about the additional error handling in the
compress-offload API. Below are highlights:
- Add the error propagating support in compress-offload API
- HD-audio: a usual Dell headset fixup, an Intel HDMI/DP fix, and the
default mixer setup change ot turn off the loopback
- Lots of updates for ASoC Intel drivers, mostly board support and
bug fixing, and to the NAU8825 driver
- Work on generalizing bits of simple-card to allow more code sharing
with the Renesas rsrc-card (which can't use simple-card due to DPCM)
- Removal of the Odroid X2 driver due to replacement with simple-card
- Support for several new Mediatek platforms and associated boards
- New ASoC drivers for Allwinner A10, Analog Devices ADAU7002,
Broadcom Cygnus, Cirrus Logic CS35L33 and CS53L30, Maxim MAX8960
and MAX98504, Realtek RT5514 and Wolfson WM8758"
* tag 'sound-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (278 commits)
sound: oss: Use kernel_read_file_from_path() for mod_firmware_load()
ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware"
ASoC: Intel: Skylake: Fix NULL Pointer exception in dynamic_debug.
ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config
ASoC: samsung: Fix error paths in the I2S driver's probe()
ASoC: cs53l30: Fix bit shift issue of TDM mode
ASoC: cs53l30: Fix a bug for TDM slot location validation
ASoC: rockchip: correct the spdif clk
ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members
ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
ASoC: simple-card: use asoc_simple_card_parse_card_name()
ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name()
ASoC: nau8825: drop redundant idiom when converting integer to boolean
ASoC: nau8825: jack connection decision with different insertion logic
ASoC: mediatek: Add HDMI dai-links to the mt8173-rt5650 machine driver
ASoC: mediatek: mt2701: fix non static symbol warning
...
Diffstat (limited to 'sound/hda/hdmi_chmap.c')
-rw-r--r-- | sound/hda/hdmi_chmap.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/sound/hda/hdmi_chmap.c b/sound/hda/hdmi_chmap.c index c6c75e7e0981..81acc20c2535 100644 --- a/sound/hda/hdmi_chmap.c +++ b/sound/hda/hdmi_chmap.c @@ -353,7 +353,8 @@ static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap, int hdmi_slot = 0; /* fill actual channel mappings in ALSA channel (i) order */ for (i = 0; i < ch_alloc->channels; i++) { - while (!ch_alloc->speakers[7 - hdmi_slot] && !WARN_ON(hdmi_slot >= 8)) + while (!WARN_ON(hdmi_slot >= 8) && + !ch_alloc->speakers[7 - hdmi_slot]) hdmi_slot++; /* skip zero slots */ hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; @@ -430,6 +431,12 @@ static int to_cea_slot(int ordered_ca, unsigned char pos) int mask = snd_hdac_chmap_to_spk_mask(pos); int i; + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (ordered_ca >= ARRAY_SIZE(channel_allocations)) + return -1; + if (mask) { for (i = 0; i < 8; i++) { if (channel_allocations[ordered_ca].speakers[7 - i] == mask) @@ -456,7 +463,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_spk_to_chmap); /* from CEA slot to ALSA API channel position */ static int from_cea_slot(int ordered_ca, unsigned char slot) { - int mask = channel_allocations[ordered_ca].speakers[7 - slot]; + int mask; + + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (slot >= 8) + return 0; + + mask = channel_allocations[ordered_ca].speakers[7 - slot]; return snd_hdac_spk_to_chmap(mask); } @@ -523,7 +538,8 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca) int ordered_ca = get_channel_allocation_order(ca); for (i = 0; i < 8; i++) { - if (i < channel_allocations[ordered_ca].channels) + if (ordered_ca < ARRAY_SIZE(channel_allocations) && + i < channel_allocations[ordered_ca].channels) map[i] = from_cea_slot(ordered_ca, hdmi_channel_mapping[ca][i] & 0x0f); else map[i] = 0; @@ -551,6 +567,12 @@ int snd_hdac_get_active_channels(int ca) { int ordered_ca = get_channel_allocation_order(ca); + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (ordered_ca >= ARRAY_SIZE(channel_allocations)) + ordered_ca = 0; + return channel_allocations[ordered_ca].channels; } EXPORT_SYMBOL_GPL(snd_hdac_get_active_channels); |