diff options
Diffstat (limited to 'sound/pci/asihpi/asihpi.c')
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 1db586af4f9c..c80b0b863c54 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -460,6 +460,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, | |||
460 | struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); | 460 | struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); |
461 | int err; | 461 | int err; |
462 | u16 format; | 462 | u16 format; |
463 | int width; | ||
463 | unsigned int bytes_per_sec; | 464 | unsigned int bytes_per_sec; |
464 | 465 | ||
465 | print_hwparams(params); | 466 | print_hwparams(params); |
@@ -512,9 +513,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, | |||
512 | dpcm->hpi_buffer_attached); | 513 | dpcm->hpi_buffer_attached); |
513 | } | 514 | } |
514 | bytes_per_sec = params_rate(params) * params_channels(params); | 515 | bytes_per_sec = params_rate(params) * params_channels(params); |
515 | bytes_per_sec *= snd_pcm_format_width(params_format(params)); | 516 | width = snd_pcm_format_width(params_format(params)); |
517 | bytes_per_sec *= width; | ||
516 | bytes_per_sec /= 8; | 518 | bytes_per_sec /= 8; |
517 | if (bytes_per_sec <= 0) | 519 | if (width < 0 || bytes_per_sec == 0) |
518 | return -EINVAL; | 520 | return -EINVAL; |
519 | 521 | ||
520 | dpcm->bytes_per_sec = bytes_per_sec; | 522 | dpcm->bytes_per_sec = bytes_per_sec; |
@@ -1383,7 +1385,7 @@ static char *asihpi_src_names[] = | |||
1383 | 1385 | ||
1384 | compile_time_assert( | 1386 | compile_time_assert( |
1385 | (ARRAY_SIZE(asihpi_src_names) == | 1387 | (ARRAY_SIZE(asihpi_src_names) == |
1386 | (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_BASE+1)), | 1388 | (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)), |
1387 | assert_src_names_size); | 1389 | assert_src_names_size); |
1388 | 1390 | ||
1389 | #if ASI_STYLE_NAMES | 1391 | #if ASI_STYLE_NAMES |
@@ -1414,7 +1416,7 @@ static char *asihpi_dst_names[] = | |||
1414 | 1416 | ||
1415 | compile_time_assert( | 1417 | compile_time_assert( |
1416 | (ARRAY_SIZE(asihpi_dst_names) == | 1418 | (ARRAY_SIZE(asihpi_dst_names) == |
1417 | (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_BASE+1)), | 1419 | (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_NONE+1)), |
1418 | assert_dst_names_size); | 1420 | assert_dst_names_size); |
1419 | 1421 | ||
1420 | static inline int ctl_add(struct snd_card *card, struct snd_kcontrol_new *ctl, | 1422 | static inline int ctl_add(struct snd_card *card, struct snd_kcontrol_new *ctl, |
@@ -2171,7 +2173,7 @@ static int snd_asihpi_mux_info(struct snd_kcontrol *kcontrol, | |||
2171 | &src_node_type, &src_node_index); | 2173 | &src_node_type, &src_node_index); |
2172 | 2174 | ||
2173 | sprintf(uinfo->value.enumerated.name, "%s %d", | 2175 | sprintf(uinfo->value.enumerated.name, "%s %d", |
2174 | asihpi_src_names[src_node_type - HPI_SOURCENODE_BASE], | 2176 | asihpi_src_names[src_node_type - HPI_SOURCENODE_NONE], |
2175 | src_node_index); | 2177 | src_node_index); |
2176 | return 0; | 2178 | return 0; |
2177 | } | 2179 | } |
@@ -2603,8 +2605,8 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | |||
2603 | 2605 | ||
2604 | } | 2606 | } |
2605 | 2607 | ||
2606 | hpi_ctl.src_node_type -= HPI_SOURCENODE_BASE; | 2608 | hpi_ctl.src_node_type -= HPI_SOURCENODE_NONE; |
2607 | hpi_ctl.dst_node_type -= HPI_DESTNODE_BASE; | 2609 | hpi_ctl.dst_node_type -= HPI_DESTNODE_NONE; |
2608 | 2610 | ||
2609 | /* ASI50xx in SSX mode has multiple meters on the same node. | 2611 | /* ASI50xx in SSX mode has multiple meters on the same node. |
2610 | Use subindex to create distinct ALSA controls | 2612 | Use subindex to create distinct ALSA controls |