aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2010-12-07 11:30:38 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-08 08:55:17 -0500
commite4f078d8c0790e94e09af975ca0b870e2f050e17 (patch)
treed7f8d21cdafc44f5a529a6aca2805a8f74132ffe /sound/soc/soc-core.c
parent5a4cfce73b7b48bdbb4e816124e5fcf84bc58e59 (diff)
ASoC: soc-core: Fix null pointer dereference
In case the codec driver did not provide a read/write function, codec->driver->read|write will be NULL. Ensure that we use the one specified in codec->read|write to avoid oopsing when we access the debugfs entries. This is achieved by using snd_soc_read() and snd_soc_write(). Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b4c8c3800503..a14a0507bbd0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -117,7 +117,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
117 * the register being volatile and the device being 117 * the register being volatile and the device being
118 * powered off. 118 * powered off.
119 */ 119 */
120 ret = codec->driver->read(codec, i); 120 ret = snd_soc_read(codec, i);
121 if (ret >= 0) 121 if (ret >= 0)
122 count += snprintf(buf + count, 122 count += snprintf(buf + count,
123 PAGE_SIZE - count, 123 PAGE_SIZE - count,
@@ -228,7 +228,7 @@ static ssize_t codec_reg_write_file(struct file *file,
228 start++; 228 start++;
229 if (strict_strtoul(start, 16, &value)) 229 if (strict_strtoul(start, 16, &value))
230 return -EINVAL; 230 return -EINVAL;
231 codec->driver->write(codec, reg, value); 231 snd_soc_write(codec, reg, value);
232 return buf_size; 232 return buf_size;
233} 233}
234 234