Subject: [PATCH] sound/pcm: we can wait when mallocing in feed_rate_init

From: Rumko <[email-masked]>
Date: Fri, 28 Jan 2011 20:06:52 +0100

If M_NOWAIT is specified, there are situations where
feed_rate_init cannot malloc the needed structures and as result
you can't open(2) the dsp devices successfully anymore.
---
 sys/dev/sound/pcm/feeder_rate.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c
index 6494a11..606c143 100644
--- a/sys/dev/sound/pcm/feeder_rate.c
+++ b/sys/dev/sound/pcm/feeder_rate.c
@@ -509,7 +509,7 @@ feed_rate_init(struct pcm_feeder *f)
 {
 	struct feed_rate_info *info;
 
-	info = kmalloc(sizeof(*info), M_RATEFEEDER, M_NOWAIT | M_ZERO);
+	info = kmalloc(sizeof(*info), M_RATEFEEDER, M_WAITOK | M_ZERO);
 	if (info == NULL)
 		return ENOMEM;
 	/*
@@ -517,7 +517,7 @@ feed_rate_init(struct pcm_feeder *f)
 	 */
 	info->bufsz = 2 + feeder_rate_buffersize;
 	info->buffer = kmalloc(sizeof(*info->buffer) * info->bufsz,
-					M_RATEFEEDER, M_NOWAIT | M_ZERO);
+					M_RATEFEEDER, M_WAITOK | M_ZERO);
 	if (info->buffer == NULL) {
 		kfree(info, M_RATEFEEDER);
 		return ENOMEM;
-- 
1.7.3.5