aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2011-01-10 05:10:56 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-10 17:19:31 -0500
commit2aa86323d815bab62a7e1d3ef8ed6c81a6dfeffa (patch)
treee57cf635b4a0bc7c8d76182f869ae4babbd12395 /sound/soc/soc-core.c
parent0d51a9cbb6c1275cc0f3840c36f8b7840a438c59 (diff)
ASoC: soc-core: Add support for NULL default register caches
The infrastructure for handling NULL default register maps is already included in the soc-cache code, just ensure that we don't try to dereference a NULL pointer while accessing a NULL register cache. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Acked-by: Timur Tabi <timur@freescale.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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 96bf381683f7..4274435853df 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3507,11 +3507,13 @@ int snd_soc_register_codec(struct device *dev,
3507 * kernel might have freed the array by the time we initialize 3507 * kernel might have freed the array by the time we initialize
3508 * the cache. 3508 * the cache.
3509 */ 3509 */
3510 codec->reg_def_copy = kmemdup(codec_drv->reg_cache_default, 3510 if (codec_drv->reg_cache_default) {
3511 reg_size, GFP_KERNEL); 3511 codec->reg_def_copy = kmemdup(codec_drv->reg_cache_default,
3512 if (!codec->reg_def_copy) { 3512 reg_size, GFP_KERNEL);
3513 ret = -ENOMEM; 3513 if (!codec->reg_def_copy) {
3514 goto fail; 3514 ret = -ENOMEM;
3515 goto fail;
3516 }
3515 } 3517 }
3516 } 3518 }
3517 3519