summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-io.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-22 12:40:52 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-23 12:11:32 +0100
commit9dfdd5abcf2b350d4fdb207c0dff3194e2fd73db (patch)
treec411f3c7a5c0b2dcb507b3d6882ad012b395ae56 /sound/soc/soc-io.c
parent62d4a4b99dfd647ef88b8434334eaa7497602857 (diff)
downloadlinux-9dfdd5abcf2b350d4fdb207c0dff3194e2fd73db.tar.bz2
ASoC: io: Don't dereference regmap if we failed to get one
Avoids a crash in invalid configurations. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-io.c')
-rw-r--r--sound/soc/soc-io.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 44d0174b4d97..29183ef2b93d 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -145,10 +145,13 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
if (!codec->control_data)
codec->control_data = dev_get_regmap(codec->dev, NULL);
- ret = regmap_get_val_bytes(codec->control_data);
- /* Errors are legitimate for non-integer byte multiples */
- if (ret > 0)
- codec->val_bytes = ret;
+ if (codec->control_data) {
+ ret = regmap_get_val_bytes(codec->control_data);
+ /* Errors are legitimate for non-integer byte
+ * multiples */
+ if (ret > 0)
+ codec->val_bytes = ret;
+ }
break;
default: