Skip to contentSkip to conversation

pci: riptide: check kzalloc() result

PATCH Applied Kulikov Vasiliy 2 participants 2 messages Jul 16, 2010 – Jul 19, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 12/15 pci: riptide: check kzalloc() result

If kzalloc() fails exit with -ENOMEM.

---
 sound/pci/riptide/riptide.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
sound/pci/riptide/riptide.c +6 -0
index 59d7996..f64fb7d 100644
@@ -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;
Signature · 1 line
1.7.0.4
Applied
#1 lore raw

At Fri, 16 Jul 2010 20:15:59 +0400,

Quoted 4 lines · Kulikov Vasiliy

If kzalloc() fails exit with -ENOMEM.

Thanks, applied now.

Takashi

Quoted 33 lines
---
 sound/pci/riptide/riptide.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
sound/pci/riptide/riptide.c +6 -0
index 59d7996..f64fb7d 100644
@@ -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;
Signature · 1 line
1.7.0.4