diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-11-10 10:24:26 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-11-10 10:24:26 -0500 |
commit | f43aa025b7de79d6a615ea4c1e6be7e6b1cea538 (patch) | |
tree | a359813d1476c158141a3c7f9bccde850bd73aaa /sound/pci/hda/hda_codec.c | |
parent | 0edb94543092535a2c6ef33e7285004168ca73d7 (diff) |
ALSA: hda - Fix another cache list management
Fix another silly bug in the amp cache list management.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 06e99c785155..5d5e8012d6a5 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -887,11 +887,10 @@ static struct hda_cache_head *get_alloc_hash(struct hda_cache_rec *cache, | |||
887 | { | 887 | { |
888 | u16 idx = key % (u16)ARRAY_SIZE(cache->hash); | 888 | u16 idx = key % (u16)ARRAY_SIZE(cache->hash); |
889 | u16 cur = cache->hash[idx]; | 889 | u16 cur = cache->hash[idx]; |
890 | struct hda_cache_head *info_head = cache->buf.list; | ||
891 | struct hda_cache_head *info; | 890 | struct hda_cache_head *info; |
892 | 891 | ||
893 | while (cur != 0xffff) { | 892 | while (cur != 0xffff) { |
894 | info = &info_head[cur]; | 893 | info = snd_array_elem(&cache->buf, cur); |
895 | if (info->key == key) | 894 | if (info->key == key) |
896 | return info; | 895 | return info; |
897 | cur = info->next; | 896 | cur = info->next; |
@@ -901,7 +900,7 @@ static struct hda_cache_head *get_alloc_hash(struct hda_cache_rec *cache, | |||
901 | info = snd_array_new(&cache->buf); | 900 | info = snd_array_new(&cache->buf); |
902 | if (!info) | 901 | if (!info) |
903 | return NULL; | 902 | return NULL; |
904 | cur = cache->buf.used - 1; /* the last entry */ | 903 | cur = snd_array_index(&cache->buf, info); |
905 | info->key = key; | 904 | info->key = key; |
906 | info->val = 0; | 905 | info->val = 0; |
907 | info->next = cache->hash[idx]; | 906 | info->next = cache->hash[idx]; |
@@ -3414,7 +3413,7 @@ void *snd_array_new(struct snd_array *array) | |||
3414 | array->list = nlist; | 3413 | array->list = nlist; |
3415 | array->alloced = num; | 3414 | array->alloced = num; |
3416 | } | 3415 | } |
3417 | return array->list + (array->used++ * array->elem_size); | 3416 | return snd_array_elem(array, array->used++); |
3418 | } | 3417 | } |
3419 | 3418 | ||
3420 | /* free the given array elements */ | 3419 | /* free the given array elements */ |