* [PATCH] ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls
@ 2010-11-08 15:37 Dimitris Papastamos
2010-11-08 15:42 ` Liam Girdwood
2010-11-08 17:28 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Dimitris Papastamos @ 2010-11-08 15:37 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches
Instead of dereferencing a NULL function pointer and falling apart
use BUG_ON() for any unimplemented hw_read() calls.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
sound/soc/soc-cache.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 8785a0c..e747998 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -25,6 +25,7 @@ static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
if (codec->cache_only)
return -1;
+ BUG_ON(!codec->hw_read);
return codec->hw_read(codec, reg);
}
@@ -99,6 +100,7 @@ static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec,
if (codec->cache_only)
return -1;
+ BUG_ON(!codec->hw_read);
return codec->hw_read(codec, reg);
}
@@ -199,6 +201,7 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec,
if (codec->cache_only)
return -1;
+ BUG_ON(!codec->hw_read);
return codec->hw_read(codec, reg);
}
@@ -270,6 +273,7 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec,
if (codec->cache_only)
return -1;
+ BUG_ON(!codec->hw_read);
return codec->hw_read(codec, reg);
} else {
return cache[reg];
@@ -420,6 +424,7 @@ static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec,
if (codec->cache_only)
return -1;
+ BUG_ON(!codec->hw_read);
return codec->hw_read(codec, reg);
}
@@ -531,6 +536,7 @@ static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec,
if (codec->cache_only)
return -1;
+ BUG_ON(!codec->hw_read);
return codec->hw_read(codec, reg);
}
--
1.7.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls
2010-11-08 15:37 [PATCH] ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls Dimitris Papastamos
@ 2010-11-08 15:42 ` Liam Girdwood
2010-11-08 17:28 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-11-08 15:42 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches
On Mon, 2010-11-08 at 15:37 +0000, Dimitris Papastamos wrote:
> Instead of dereferencing a NULL function pointer and falling apart
> use BUG_ON() for any unimplemented hw_read() calls.
>
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> ---
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls
2010-11-08 15:37 [PATCH] ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls Dimitris Papastamos
2010-11-08 15:42 ` Liam Girdwood
@ 2010-11-08 17:28 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-11-08 17:28 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: alsa-devel, patches, Liam Girdwood
On Mon, Nov 08, 2010 at 03:37:07PM +0000, Dimitris Papastamos wrote:
> Instead of dereferencing a NULL function pointer and falling apart
> use BUG_ON() for any unimplemented hw_read() calls.
>
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-08 17:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-08 15:37 [PATCH] ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls Dimitris Papastamos
2010-11-08 15:42 ` Liam Girdwood
2010-11-08 17:28 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).