Skip to content

Commit 68bf570

Browse files
segoontiwai
authored andcommitted
ALSA: riptide: check kzalloc() result
If kzalloc() fails exit with -ENOMEM. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 0b6d092 commit 68bf570

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎sound/pci/riptide/riptide.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,10 @@ static int snd_riptide_playback_open(struct snd_pcm_substream *substream)
16151615

16161616
chip->playback_substream[sub_num] = substream;
16171617
runtime->hw = snd_riptide_playback;
1618+
16181619
data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
1620+
if (data == NULL)
1621+
return -ENOMEM;
16191622
data->paths = lbus_play_paths[sub_num];
16201623
data->id = play_ids[sub_num];
16211624
data->source = play_sources[sub_num];
@@ -1635,7 +1638,10 @@ static int snd_riptide_capture_open(struct snd_pcm_substream *substream)
16351638

16361639
chip->capture_substream = substream;
16371640
runtime->hw = snd_riptide_capture;
1641+
16381642
data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
1643+
if (data == NULL)
1644+
return -ENOMEM;
16391645
data->paths = lbus_rec_path;
16401646
data->id = PADC;
16411647
data->source = ACLNK2PADC;

0 commit comments

Comments
 (0)