提交 9dfdd5ab 编写于 作者: M Mark Brown

ASoC: io: Don't dereference regmap if we failed to get one

Avoids a crash in invalid configurations.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: NLiam Girdwood <lrg@ti.com>
上级 62d4a4b9
...@@ -145,10 +145,13 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, ...@@ -145,10 +145,13 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
if (!codec->control_data) if (!codec->control_data)
codec->control_data = dev_get_regmap(codec->dev, NULL); codec->control_data = dev_get_regmap(codec->dev, NULL);
ret = regmap_get_val_bytes(codec->control_data); if (codec->control_data) {
/* Errors are legitimate for non-integer byte multiples */ ret = regmap_get_val_bytes(codec->control_data);
if (ret > 0) /* Errors are legitimate for non-integer byte
codec->val_bytes = ret; * multiples */
if (ret > 0)
codec->val_bytes = ret;
}
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册