Fix driver conf parsing in snd_config_hook_load_for_all_cards()
Fix driver conf parsing in snd_config_hook_load_for_all_cards()

Reported by Kevin Goodsell.

Summary: load_for_all_cards fails with existing configuration elements

In snd_config_hook_load_for_all_cards, the first call to
snd_config_search attempts to locate an existing configuration node with
the name of the driver.  Typically none is found, and everything is
good. However, if such a node is located, the next line assumes it is a
leaf node with type 'string' and calls snd_config_get_string to fetch
the string value. If this fails, the entire hook is abandoned.

Because of this, setting something like the following in asoundrc:

cards.<driver name>.foo 0

is sufficient to disable the entire card-specific configuration.

As a concrete example, I have a HDA-Intel sound card. dmix.conf includes
a way to set period_size, period_time, and periods by using
configuration elements of the form cards.<driver name>.pcm.dmix.<var>.
In ~/.asoundrc I add

cards.HDA-Intel.pcm.dmix.period_size 1024

This will cause HDA-Intel.conf to fail to load, and the pcm defined in
default.conf will fail to find the device-specific pcm
cards.HDA-Intel.pcm.default, and fall back on the default pcm using
plughw.  By attempting to configure dmix, I have disabled it.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

mengdonglin/alsa-lib,mikelima/alsa-lib,gittup/alsa-lib,gittup/alsa-lib,takaswie/alsa-lib,gittup/alsa-lib,mikelima/alsa-lib,alsa-project/alsa-lib,takaswie/alsa-lib,lgirdwood/alsa-lib,tiwai/alsa-lib,alsa-project/alsa-lib,lgirdwood/alsa-lib,zedongchen/alsa-lib,zedongchen/alsa-lib,mikelima/alsa-lib,takaswie/alsa-lib,mengdonglin/alsa-lib,lgirdwood/alsa-lib,tiwai/alsa-lib,alsa-project/alsa-lib,mikelima/alsa-lib,Distrotech/alsa-lib,zedongchen/alsa-lib,mengdonglin/alsa-lib,tiwai/alsa-lib,Distrotech/alsa-lib,Distrotech/alsa-lib,Distrotech/alsa-lib,alsa-project/alsa-lib,tiwai/alsa-lib,gittup/alsa-lib,zedongchen/alsa-lib,lgirdwood/alsa-lib,mengdonglin/alsa-lib,Distrotech/alsa-lib,takaswie/alsa-lib,lgirdwood/alsa-lib,mengdonglin/alsa-lib,mikelima/alsa-lib,zedongchen/alsa-lib,takaswie/alsa-lib