Skip to content

Commit

Permalink
ASoC: soc-core: Fix null pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dimitris Papastamos authored and Mark Brown committed Dec 8, 2010
1 parent 5a4cfce commit e4f078d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
* the register being volatile and the device being
* powered off.
*/
ret = codec->driver->read(codec, i);
ret = snd_soc_read(codec, i);
if (ret >= 0)
count += snprintf(buf + count,
PAGE_SIZE - count,
Expand Down Expand Up @@ -228,7 +228,7 @@ static ssize_t codec_reg_write_file(struct file *file,
start++;
if (strict_strtoul(start, 16, &value))
return -EINVAL;
codec->driver->write(codec, reg, value);
snd_soc_write(codec, reg, value);
return buf_size;
}

Expand Down

0 comments on commit e4f078d

Please sign in to comment.