All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-core: Add support for NULL default register caches
@ 2011-01-10 10:10 Dimitris Papastamos
  2011-01-10 21:48 ` Liam Girdwood
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dimitris Papastamos @ 2011-01-10 10:10 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches, Timur Tabi

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>
---
 sound/soc/soc-core.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index bac7291..a9f19c1 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3503,11 +3503,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;
+			}
 		}
 	}
 
-- 
1.7.3.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-10 23:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 10:10 [PATCH] ASoC: soc-core: Add support for NULL default register caches Dimitris Papastamos
2011-01-10 21:48 ` Liam Girdwood
2011-01-10 22:10 ` Timur Tabi
2011-01-10 22:29   ` Mark Brown
2011-01-10 22:40     ` Timur Tabi
2011-01-10 23:48       ` Mark Brown
2011-01-10 22:25 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.