Skip to content

Commit

Permalink
ALSA: hda - Add sanity check in PCM open callback
Browse files Browse the repository at this point in the history
Add some sanity checks of struct snd_pcm_hardware fields in the PCM
open callback of hda driver.  This makes a bit easier to debug any PCM
setup errors in the codec side.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Jul 3, 2009
1 parent 70d321e commit c470331
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,12 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);
mutex_unlock(&chip->open_mutex);

if (snd_BUG_ON(!runtime->hw.channels_min || !runtime->hw.channels_max))
return -EINVAL;
if (snd_BUG_ON(!runtime->hw.formats))
return -EINVAL;
if (snd_BUG_ON(!runtime->hw.rates))
return -EINVAL;
return 0;
}

Expand Down

0 comments on commit c470331

Please sign in to comment.