diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 96bf381683f7e68566ff60578ddb97600f6778b5..4274435853dff7d36563ecf832a530f3eb7cf681 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, * kernel might have freed the array by the time we initialize * the cache. */ - codec->reg_def_copy = kmemdup(codec_drv->reg_cache_default, - reg_size, GFP_KERNEL); - if (!codec->reg_def_copy) { - ret = -ENOMEM; - goto fail; + if (codec_drv->reg_cache_default) { + codec->reg_def_copy = kmemdup(codec_drv->reg_cache_default, + reg_size, GFP_KERNEL); + if (!codec->reg_def_copy) { + ret = -ENOMEM; + goto fail; + } } }