Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 221951
b: refs/heads/master
c: 08da782
h: refs/heads/master
i:
  221949: 7eb8593
  221947: 18b1d31
  221943: ab1d9af
  221935: e4c057a
  221919: 20ae429
  221887: be68127
  221823: de404f0
  221695: b5656fa
v: v3
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Nov 9, 2010
1 parent 3b1175c commit 2e74198
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9f25689a86570c30d3f101b1f9834a579bed2e5
refs/heads/master: 08da782b1a58fd63199928176909e103477c933a
29 changes: 22 additions & 7 deletions trunk/drivers/staging/intel_sst/intel_sst_app_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ static int intel_sst_mmap_play_capture(u32 str_id,
int retval, i;
struct stream_info *stream;
struct snd_sst_mmap_buff_entry *buf_entry;
struct snd_sst_mmap_buff_entry *tmp_buf;

pr_debug("sst:called for str_id %d\n", str_id);
retval = sst_validate_strid(str_id);
if (retval)
return -EINVAL;
BUG_ON(!mmap_buf);

stream = &sst_drv_ctx->streams[str_id];
if (stream->mmapped != true)
Expand All @@ -262,14 +262,24 @@ static int intel_sst_mmap_play_capture(u32 str_id,
stream->curr_bytes = 0;
stream->cumm_bytes = 0;

tmp_buf = kcalloc(mmap_buf->entries, sizeof(*tmp_buf), GFP_KERNEL);
if (!tmp_buf)
return -ENOMEM;
if (copy_from_user(tmp_buf, (void __user *)mmap_buf->buff,
mmap_buf->entries * sizeof(*tmp_buf))) {
retval = -EFAULT;
goto out_free;
}

pr_debug("sst:new buffers count %d status %d\n",
mmap_buf->entries, stream->status);
buf_entry = mmap_buf->buff;
buf_entry = tmp_buf;
for (i = 0; i < mmap_buf->entries; i++) {
BUG_ON(!buf_entry);
bufs = kzalloc(sizeof(*bufs), GFP_KERNEL);
if (!bufs)
return -ENOMEM;
if (!bufs) {
retval = -ENOMEM;
goto out_free;
}
bufs->size = buf_entry->size;
bufs->offset = buf_entry->offset;
bufs->addr = sst_drv_ctx->mmap_mem;
Expand All @@ -293,13 +303,15 @@ static int intel_sst_mmap_play_capture(u32 str_id,
if (sst_play_frame(str_id) < 0) {
pr_warn("sst: play frames fail\n");
mutex_unlock(&stream->lock);
return -EIO;
retval = -EIO;
goto out_free;
}
} else if (stream->ops == STREAM_OPS_CAPTURE) {
if (sst_capture_frame(str_id) < 0) {
pr_warn("sst: capture frame fail\n");
mutex_unlock(&stream->lock);
return -EIO;
retval = -EIO;
goto out_free;
}
}
}
Expand All @@ -314,6 +326,9 @@ static int intel_sst_mmap_play_capture(u32 str_id,
if (retval >= 0)
retval = stream->cumm_bytes;
pr_debug("sst:end of play/rec ioctl bytes = %d!!\n", retval);

out_free:
kfree(tmp_buf);
return retval;
}

Expand Down

0 comments on commit 2e74198

Please sign in to comment.