ALSA: riptide: check kzalloc() result
authorKulikov Vasiliy <segooon@gmail.com>
Fri, 16 Jul 2010 16:15:59 +0000 (20:15 +0400)
committerTakashi Iwai <tiwai@suse.de>
Mon, 19 Jul 2010 15:59:26 +0000 (17:59 +0200)
If kzalloc() fails exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/riptide/riptide.c

index 59d79962f2367e3a98cc9fc4db47c65576a6ff79..f64fb7d988cb57f63876bbc92f0b94d93beb9cfe 100644 (file)
@@ -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];
@@ -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;