]> asedeno.scripts.mit.edu Git - linux.git/commit
ALSA: hda/analog - Minor optimization for SPDIF mux connections
authorTakashi Iwai <tiwai@suse.de>
Wed, 15 Jan 2020 10:00:35 +0000 (11:00 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 16 Jan 2020 16:29:17 +0000 (17:29 +0100)
commit2ba0176c709c103974cf55b6d373c4ea749c6391
tree7ad0def740a156e30c9ffd2b9f147ad6ba67bdd7
parentc249177944b650816069f6c49b769baaa94339dc
ALSA: hda/analog - Minor optimization for SPDIF mux connections

AD HD-audio codec driver has a few code lines invoking
snd_get_num_conns() and using its return value as the array index
without checking.  This is basically safe in all those places; at the
second and later calls snd_get_num_conns() returns the value cached
from the first invocation, hence the value is always consistent.

However, it looks a bit confusing as if a lack of the proper check.
This patch introduces a new field num_smux_conns in ad198x_spec for
simplifying the code.  Now we store and refer to the value more
locally without invoking the extra function at each time.

Reported-by: Colin King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200115100035.22511-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_analog.c