Skip to content

Commit

Permalink
ALSA: riptide: check kzalloc() result
Browse files Browse the repository at this point in the history
If kzalloc() fails exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Kulikov Vasiliy authored and Takashi Iwai committed Jul 19, 2010
1 parent 0b6d092 commit 68bf570
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/pci/riptide/riptide.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,10 @@ static int snd_riptide_playback_open(struct snd_pcm_substream *substream)

chip->playback_substream[sub_num] = substream;
runtime->hw = snd_riptide_playback;

data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
data->paths = lbus_play_paths[sub_num];
data->id = play_ids[sub_num];
data->source = play_sources[sub_num];
Expand All @@ -1635,7 +1638,10 @@ static int snd_riptide_capture_open(struct snd_pcm_substream *substream)

chip->capture_substream = substream;
runtime->hw = snd_riptide_capture;

data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
if (data == NULL)
return -ENOMEM;
data->paths = lbus_rec_path;
data->id = PADC;
data->source = ACLNK2PADC;
Expand Down

0 comments on commit 68bf570

Please sign in to comment.