Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353368
b: refs/heads/master
c: b5a8fe4
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Jan 21, 2013
1 parent 8c34d19 commit 25061ab
Show file tree
Hide file tree
Showing 2 changed files with 6 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: 5d163336a77af9c1b4d6d08cbc8b1279df5f579e
refs/heads/master: b5a8fe439ab343631d905a51438db3de54ba94df
12 changes: 5 additions & 7 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3097,9 +3097,12 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
if (!codec->using_regmap)
return -EINVAL;

data = ucontrol->value.bytes.data;
len = params->num_regs * codec->val_bytes;

data = kmemdup(ucontrol->value.bytes.data, len, GFP_KERNEL | GFP_DMA);
if (!data)
return -ENOMEM;

/*
* If we've got a mask then we need to preserve the register
* bits. We shouldn't modify the incoming data so take a
Expand All @@ -3112,10 +3115,6 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,

val &= params->mask;

data = kmemdup(data, len, GFP_KERNEL);
if (!data)
return -ENOMEM;

switch (codec->val_bytes) {
case 1:
((u8 *)data)[0] &= ~params->mask;
Expand All @@ -3137,8 +3136,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
ret = regmap_raw_write(codec->control_data, params->base,
data, len);

if (params->mask)
kfree(data);
kfree(data);

return ret;
}
Expand Down

0 comments on commit 25061ab

Please sign in to comment.