diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 11:44:01 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:28:58 -0500 |
commit | 73e77ba0235532bd7523ba90883d325f6e095acf (patch) | |
tree | d22f29805ade9e78bd5f1802590d42f6e121c3c1 /sound/core/rawmidi.c | |
parent | 00a4e3d9f8df8a90966b75d517154718b4a2242a (diff) |
[ALSA] Add error messages
Add error messages in the critial error path to be more verbose.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/rawmidi.c')
-rw-r--r-- | sound/core/rawmidi.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index ede0a6083d29..7a86a9a08a15 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -1382,8 +1382,10 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi, | |||
1382 | INIT_LIST_HEAD(&stream->substreams); | 1382 | INIT_LIST_HEAD(&stream->substreams); |
1383 | for (idx = 0; idx < count; idx++) { | 1383 | for (idx = 0; idx < count; idx++) { |
1384 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); | 1384 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
1385 | if (substream == NULL) | 1385 | if (substream == NULL) { |
1386 | snd_printk(KERN_ERR "rawmidi: cannot allocate substream\n"); | ||
1386 | return -ENOMEM; | 1387 | return -ENOMEM; |
1388 | } | ||
1387 | substream->stream = direction; | 1389 | substream->stream = direction; |
1388 | substream->number = idx; | 1390 | substream->number = idx; |
1389 | substream->rmidi = rmidi; | 1391 | substream->rmidi = rmidi; |
@@ -1425,19 +1427,27 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, | |||
1425 | *rrawmidi = NULL; | 1427 | *rrawmidi = NULL; |
1426 | snd_assert(card != NULL, return -ENXIO); | 1428 | snd_assert(card != NULL, return -ENXIO); |
1427 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); | 1429 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); |
1428 | if (rmidi == NULL) | 1430 | if (rmidi == NULL) { |
1431 | snd_printk(KERN_ERR "rawmidi: cannot allocate\n"); | ||
1429 | return -ENOMEM; | 1432 | return -ENOMEM; |
1433 | } | ||
1430 | rmidi->card = card; | 1434 | rmidi->card = card; |
1431 | rmidi->device = device; | 1435 | rmidi->device = device; |
1432 | init_MUTEX(&rmidi->open_mutex); | 1436 | init_MUTEX(&rmidi->open_mutex); |
1433 | init_waitqueue_head(&rmidi->open_wait); | 1437 | init_waitqueue_head(&rmidi->open_wait); |
1434 | if (id != NULL) | 1438 | if (id != NULL) |
1435 | strlcpy(rmidi->id, id, sizeof(rmidi->id)); | 1439 | strlcpy(rmidi->id, id, sizeof(rmidi->id)); |
1436 | if ((err = snd_rawmidi_alloc_substreams(rmidi, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT], SNDRV_RAWMIDI_STREAM_INPUT, input_count)) < 0) { | 1440 | if ((err = snd_rawmidi_alloc_substreams(rmidi, |
1441 | &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT], | ||
1442 | SNDRV_RAWMIDI_STREAM_INPUT, | ||
1443 | input_count)) < 0) { | ||
1437 | snd_rawmidi_free(rmidi); | 1444 | snd_rawmidi_free(rmidi); |
1438 | return err; | 1445 | return err; |
1439 | } | 1446 | } |
1440 | if ((err = snd_rawmidi_alloc_substreams(rmidi, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT], SNDRV_RAWMIDI_STREAM_OUTPUT, output_count)) < 0) { | 1447 | if ((err = snd_rawmidi_alloc_substreams(rmidi, |
1448 | &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT], | ||
1449 | SNDRV_RAWMIDI_STREAM_OUTPUT, | ||
1450 | output_count)) < 0) { | ||
1441 | snd_rawmidi_free(rmidi); | 1451 | snd_rawmidi_free(rmidi); |
1442 | return err; | 1452 | return err; |
1443 | } | 1453 | } |