Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216634
b: refs/heads/master
c: 2b194f9
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Oct 13, 2010
1 parent 23835f0 commit 917ce25
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 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: 4abe8e16a8ad879027de3a0a088f281577ad24a9
refs/heads/master: 2b194f9db444875b4509e6dc92c949c57437c826
49 changes: 34 additions & 15 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,22 @@ static ssize_t codec_list_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
ssize_t ret = 0;
ssize_t len, ret = 0;
struct snd_soc_codec *codec;

if (!buf)
return -ENOMEM;

list_for_each_entry(codec, &codec_list, list)
ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
codec->name);
list_for_each_entry(codec, &codec_list, list) {
len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
codec->name);
if (len >= 0)
ret += len;
if (ret > PAGE_SIZE) {
ret = PAGE_SIZE;
break;
}
}

if (ret >= 0)
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
Expand All @@ -301,17 +308,23 @@ static ssize_t dai_list_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
ssize_t ret = 0;
ssize_t len, ret = 0;
struct snd_soc_dai *dai;

if (!buf)
return -ENOMEM;

list_for_each_entry(dai, &dai_list, list)
ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", dai->name);
list_for_each_entry(dai, &dai_list, list) {
len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", dai->name);
if (len >= 0)
ret += len;
if (ret > PAGE_SIZE) {
ret = PAGE_SIZE;
break;
}
}

if (ret >= 0)
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);

kfree(buf);

Expand All @@ -328,18 +341,24 @@ static ssize_t platform_list_read_file(struct file *file,
size_t count, loff_t *ppos)
{
char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
ssize_t ret = 0;
ssize_t len, ret = 0;
struct snd_soc_platform *platform;

if (!buf)
return -ENOMEM;

list_for_each_entry(platform, &platform_list, list)
ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
platform->name);
list_for_each_entry(platform, &platform_list, list) {
len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n",
platform->name);
if (len >= 0)
ret += len;
if (ret > PAGE_SIZE) {
ret = PAGE_SIZE;
break;
}
}

if (ret >= 0)
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);

kfree(buf);

Expand Down

0 comments on commit 917ce25

Please sign in to comment.