Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46fdaa3b authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown
Browse files

ASoC: soc-cache: dereferencing before checking



The patch c358e640 "ASoC: soc-cache: Add trace event for
snd_soc_cache_sync()" introduced a dereference of "codec->cache_ops"
before we had checked it for NULL.

I pulled the check forward, and then pulled everything in an indent
level.

Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a98a0bc6
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -1609,12 +1609,14 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
		return 0;
	}

	if (!codec->cache_ops || !codec->cache_ops->sync)
		return -EINVAL;

	if (codec->cache_ops->name)
		name = codec->cache_ops->name;
	else
		name = "unknown";

	if (codec->cache_ops && codec->cache_ops->sync) {
	if (codec->cache_ops->name)
		dev_dbg(codec->dev, "Syncing %s cache for %s codec\n",
			codec->cache_ops->name, codec->name);
@@ -1625,9 +1627,6 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
	trace_snd_soc_cache_sync(codec, name, "end");
	return ret;
}

	return -EINVAL;
}
EXPORT_SYMBOL_GPL(snd_soc_cache_sync);

static int snd_soc_get_reg_access_index(struct snd_soc_codec *codec,